Skip to content

Commit a3d4e81

Browse files
committed
daily
1 parent bdaa865 commit a3d4e81

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

2924. Find Champion II.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://leetcode.com/problems/find-champion-ii
2+
# simple logic, don't need graph theory
3+
4+
def findChampion(n: int, edges: list[list[int]]) -> int:
5+
champion = [True] * n
6+
for a, b in edges:
7+
champion[b] = False
8+
9+
if champion.count(True) > 1:
10+
return -1
11+
return champion.index(True)

0 commit comments

Comments
 (0)