Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Winning Players

med
30 min
Try to solve the Find the Number of Winning Players problem.

Statement

You are given an integer n representing the total number of players indexed from 00 to n −1- 1.

You are also given a 22D integer array pick, where each pick[i] = [x_i, y_i] indicates that player x_i selected a ball of color y_i.

Player i wins the game if they collect strictly more than i balls of the same color (that is, at least i +1+ 1 balls sharing an identical color).

Return the total count of players who win the game.

Note: Multiple players can win the game, and each winning player is counted only once.

Constraints:

  • 2≤2 \leq n ≤10\leq 10

  • 1≤1 \leq pick.length ≤100\leq 100

  • pick[i].length =2= 2

  • 0≤xi≤0 \leq x_i \leq n −1- 1

  • 0≤yi≤100 \leq y_i \leq 10

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Winning Players

med
30 min
Try to solve the Find the Number of Winning Players problem.

Statement

You are given an integer n representing the total number of players indexed from 00 to n −1- 1.

You are also given a 22D integer array pick, where each pick[i] = [x_i, y_i] indicates that player x_i selected a ball of color y_i.

Player i wins the game if they collect strictly more than i balls of the same color (that is, at least i +1+ 1 balls sharing an identical color).

Return the total count of players who win the game.

Note: Multiple players can win the game, and each winning player is counted only once.

Constraints:

  • 2≤2 \leq n ≤10\leq 10

  • 1≤1 \leq pick.length ≤100\leq 100

  • pick[i].length =2= 2

  • 0≤xi≤0 \leq x_i \leq n −1- 1

  • 0≤yi≤100 \leq y_i \leq 10