Easy JAVA solution
Intution\nThe intuition behind the code is that we can process the picks in sorted order based on the first element (row number). We can keep track of the winni
# Intution\nThe intuition behind the code is that we can process the picks in sorted order based on the first element (row number). We can keep track of the winning condition using a stack. \n# Approach\nThe approach followed in the code is to use a stack to keep track of the current row being played. We also use a visited array to keep track of which rows have been played and won. \n\nHere\'s how the code works:\n\n1. We define a class `Info` to store the row and column information of a pick.\n2. We define a class `Solution` with a method `winningPlayerCount` that takes the number of rows (`n`) and the picks (`pick`) as input.\n3. We create a stack `stack` to store the current row information.\n4. We initialize a variable `count` to keep track of the number of players who have picked the current row.\n5. We initialize a variable `ans` to store the final count of winning players.\n6. We create a visited array `vis` to keep track of visited rows.\n7. We sort the picks array based on the first element (row number) and then the second element (column number).\n8. We iterate over the sorted picks array:\n    - If the stack is empty, we push the current pick information onto the stack and initialize `count` to 1. If the current row hasn\'t been visited and `count` is greater than the row number, we increment `ans` and mark the row as visited.\n    - If the stack is not empty and the current pick matches the top element of the stack, we increment `count`. If the current row hasn\'t been visited and `count` is greater than the row number, we increment `ans` and mark the row as visited.\n    - Otherwise, we pop the top element from the stack, push the current pick information onto the stack, and reset `count` to 1. If the current row hasn\'t been visited and `count` is greater than the row number, we increment `ans` and mark the row as visited.\n9. Finally, we return the `ans`.\n\n# Complexity\nThe time complexity of this approach is` O(n log n)` because of the sorting of the picks array. The space complexity is `O(n)` due to the stack and visited array.\n\n# Code\n```\nclass Info {\n    int x;\n    int y;\n\n    public Info(int x, int y) {\n        this.x = x;\n        this.y = y;\n    }\n}\n\nclass Solution {\n    public int winningPlayerCount(int n, int[][] pick) {\n        Stack<Info> stack = new Stack<>();\n        int count = 0;\n        int ans = 0;\n        boolean[] vis = new boolean[n];\n\n        Arrays.sort(pick, (a, b) -> {\n            if (a[0] != b[0]) {\n                return Integer.compare(a[0], b[0]);\n            } else {\n                return Integer.compare(a[1], b[1]);\n            }\n        });\n\n        for (int i = 0; i < pick.length; i++) {\n            if (stack.isEmpty()) {\n                stack.push(new Info(pick[i][0], pick[i][1]));\n                count = 1;\n                if(!vis[pick[i][0]]){\n                if (count > pick[i][0]) {\n                    ans++;\n                    vis[pick[i][0]]=true;\n                }\n                }\n            } else {\n                if (stack.peek().x == pick[i][0] && stack.peek().y == pick[i][1]) {\n                    count++;\n                    if(!vis[pick[i][0]]){\n                if (count > pick[i][0]) {\n                    ans++;\n                    vis[pick[i][0]]=true;\n                }\n                }\n                } else {\n                    stack.pop();\n                    stack.push(new Info(pick[i][0], pick[i][1]));\n                    count = 1;\n                    if(!vis[pick[i][0]]){\n                if (count > pick[i][0]) {\n                    ans++;\n                    vis[pick[i][0]]=true;\n                }\n                }\n                }\n            }\n        }\n\n        return ans;\n    }\n}\n\n```
['Stack', 'Java']