We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6accd6d commit 133bc38Copy full SHA for 133bc38
src/0901-1000/997 - Find the Town Judge/solution.py
@@ -0,0 +1,12 @@
1
+class Solution:
2
+ def findJudge(self, n: int, trust: list[list[int]]) -> int:
3
+ count = [0] * (n + 1)
4
+ for i, j in trust:
5
+ count[i] -= 1
6
+ count[j] += 1
7
+
8
+ for i in range(1, n + 1):
9
+ if count[i] == n - 1:
10
+ return i
11
12
+ return -1
0 commit comments