Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cd769ac

Browse files
Create 2225.py
1 parent 684c4f7 commit cd769ac

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎2001-2500/2225.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def findWinners(self, matches: List[List[int]]) -> List[List[int]]:
3+
d = defaultdict(int)
4+
players = set()
5+
for w,l in matches:
6+
d[l] += 1
7+
players.add(w)
8+
players.add(l)
9+
ans = [[],[]]
10+
for p in sorted(players):
11+
if d[p]==0 or d[p]==1:
12+
ans[d[p]].append(p)
13+
return ans

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /