Skip to content

Commit

Permalink
add: 3238. 求出胜利玩家的数目
Browse files Browse the repository at this point in the history
  • Loading branch information
KevenGe committed Nov 25, 2024
1 parent dc902cf commit c2b1d4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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/
17 changes: 17 additions & 0 deletions problemset/3238. 求出胜利玩家的数目/solution.py
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)

0 comments on commit c2b1d4e

Please sign in to comment.