-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
META: | ||
ID: 3238 | ||
TITLE_CN: 求出胜利玩家的数目 | ||
HARD_LEVEL: EASY | ||
URL: https://leetcode.cn/problems/find-the-number-of-winning-players/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from typing import List | ||
|
||
|
||
class Solution: | ||
def winningPlayerCount(self, n: int, pick: List[List[int]]) -> int: | ||
|
||
winner = set() | ||
player_dict = dict() | ||
for x, y in pick: | ||
if x not in player_dict: | ||
player_dict[x] = dict() | ||
if y not in player_dict[x]: | ||
player_dict[x][y] = 0 | ||
player_dict[x][y] += 1 | ||
if player_dict[x][y] > x: | ||
winner.add(x) | ||
return len(winner) |