Two counts per person
With arrows, "how connected is this person?" splits into two questions. How many arrows point at them? Those are their followers. How many arrows leave them? That is how many people they follow.
Read each arrow once: it leaves the person who follows, and lands on the person being followed. So one pass over the arrows gives both counts.
The arrow leaves: the follower's following count goes up.
The arrow lands: the followed person's follower count goes up.
followers = [0] * n
following = [0] * n
for a, b in follows:
following[a] += 1
followers[b] += 1
for person in range(n):
if followers[person] != n - 1:
continue
if following[person] == 0:
return person
return -14 people, follows [[0, 3], [1, 3], [2, 3], [0, 1], [2, 0]]
Four people. Under each one: arrows in (followers) and arrows out (following). All zero so far.
Move 1 of 5
Spotting the influencer
An influencer is followed by everyone else, which is n minus 1 followers, and follows nobody. Both conditions matter: plenty of popular people follow a few others back.
After counting, check each person. There cannot be two influencers, because each would have to follow the other.
Followed by everyone else and following nobody: both, not just one.
Nobody matches: answer minus one.