3238.求出胜利玩家的数目
链接:3238.求出胜利玩家的数目
难度:Easy
标签:数组、哈希表、计数
简介:请你返回游戏中 胜利玩家 的数目。
题解 1 - python
- 编辑时间:2024-11-23
- 执行用时:4ms
- 内存消耗:16.44MB
- 编程语言:python
- 解法介绍:遍历
class Solution:
def winningPlayerCount(self, n: int, pick: List[List[int]]) -> int:
res = set()
arr = [defaultdict(int) for _ in range(n)]
for x, y in pick:
arr[x][y] += 1
if arr[x][y] > x:
res.add(x)
return len(res)