Skip to content

Commit

Permalink
Day 19-q1 python code added SnowScriptWinterOfCode#415
Browse files Browse the repository at this point in the history
  • Loading branch information
Tech-neophyte authored Jan 17, 2024
1 parent f121f12 commit e9e1e73
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Day-19/q1 Find Players With Zero or One Losses/Tech-neophyte--p.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Python code: (Using dict)
```
class Solution:
def findWinners(self, matches: List[List[int]]) -> List[List[int]]:
loss={}
for p in matches:
x, y=p
if x not in loss: loss[x]=0
if y in loss: loss[y]+=1
else: loss[y]=1
ans=[[], []]
for i, f in loss.items():
if f==0:
ans[0].append(i)
elif f==1:
ans[1].append(i)
return [sorted(ans[0]), sorted(ans[1])]
```

0 comments on commit e9e1e73

Please sign in to comment.