C++ solution
ApproachAs you know, we have maximum 10 colors and n players. What if we create a two-dimensional array in which for each player we will store the number of bal
# Approach

As you know, we have maximum 10 colors and n players. What if we create a two-dimensional array in which for each player we will store the number of balls of each color that he has chosen? Let's create a two-dimensional array with a size of ***n + 1*** x ***11***, so as not to get confused with indexes (you can use a smaller dimension, but then the conditions in the code will have to be slightly changed). We fill in our array and then use nested loops for each player to examine the balls they have selected. **If ***i*** player** **has more than *i* balls of the same color selected**, then we can say that this player has won.

# Complexity
Time complexity: ***O(n * k)***, because in the worst case, for each of the ***n*** players, we will consider all ***k*** colors (either the balls of the last color will be selected the required number of times, or this player has lost)


# Code
```cpp []
class Solution {
public:
    int winningPlayerCount(int n, vector<vector<int>>& pick) {
        std::vector<std::vector<int>> PlayerColor (n + 1, std::vector<int>(11, 0));
        int res = 0;

        for (int i = 0; i < pick.size(); i++) {
            PlayerColor[pick[i][0]][pick[i][1]]++;
        }

        for (int j = 0; j < PlayerColor.size(); j++) {
            for (int k = 0; k < 11; k++) {
                if (PlayerColor[j][k] > j) {
                    res++;
                    break;
                }
            }
        }

        return res;
    }
};
```
['C++']