indegrees
and outdegrees
, with a length of n + 1
to account for the 1-based indexing.trust
array, incrementing the outdegree of the trusting person and the indegree of the trusted person.1
to n
and check if there is a person with an indegree of n - 1
and an outdegree of 0
.-1
.