The trust relationships form a directed graph where each edge means person trusts person . The town judge is the vertex with in-degree and out-degree .
You can represent this using an array of in-degrees and out-degrees. Each trust pair increments one counter and decrements another.
This translation is the hard part. Once you see it is a degree-counting problem, the code writes itself.