Graph Theory37 sections · 1633 units
Open in Course

Town Judge - The Story

Understanding the Rules

There are NN people. There is a rumor of a secret judge. Rules:

1.1. The town judge trusts nobody.

2.2. Everybody (except the judge) trusts the judge.

3.3. Exactly one person satisfies both conditions.

In graph terms: the judge has in-degree N1N-1 and out-degree 00. You do not need to build an actual graph. Count degrees. For each trust pair (a,b)(a, b), increment bsindegreeandbs in-degree and as out-degree. Find the person matching both conditions. If none exists, return 1-1.