3238. Find the Number of Winning Players
You are given an integer
n
representing the number of players in a game and a 2D arraypick
wherepick[i] = [xi, yi]
represents that the playerxi
picked a ball of coloryi
.Player
i
wins the game if they pick strictly more thani
balls of the same color. In other words,
- Player 0 wins if they pick any ball.
- Player 1 wins if they pick at least two balls of the same color.
- …
- Player
i
wins if they pick at leasti + 1
balls of the same color.Return the number of players who win the game.
Note that multiple players can win the game.
1 | class Solution { |