There are people. There is a rumor of a secret judge. Rules:
The town judge trusts nobody.
Everybody (except the judge) trusts the judge.
Exactly one person satisfies both conditions.
In graph terms: the judge has in-degree and out-degree . You do not need to build an actual graph. Count degrees. For each trust pair , increment as out-degree. Find the person matching both conditions. If none exists, return .