Easy CPP for begineers!!! simulate the game
Intuition\nNeed a data structure to store the balls color. Best is 2d matrix to store!\n\n# Approach\nMatrix arr:\n    The matrix arr keeps track of how many ti
# Intuition\nNeed a data structure to store the balls color. Best is 2d matrix to store!\n\n# Approach\nMatrix arr:\n    The matrix arr keeps track of how many times each player picks  each color. The rows represent players, and the columns represent colors.\nWinning Condition:\n    A player is considered a "winning player" if they have picked any color more times than their player index. This is checked using the condition arr[i][j] > i.\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n```\nclass Solution {\npublic:\n    int winningPlayerCount(int n, vector<vector<int>>& pick) {\n        vector<vector<int>>arr(n,vector<int>(11,0));\n        int ans=0;\n        for(int i=0;i<pick.size();i++){\n            int player=pick[i][0];\n            int color=pick[i][1];\n            arr[player][color]++;\n        }\n        for(int i=0;i<n;i++){\n            for(int j=0;j<=10;j++){\n                if(arr[i][j] >i){\n                    ans++;\n                    break;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['Matrix', 'Simulation', 'C++']