Using Arrays.hashCode(row[])
Approach\nThrough this code, I am Hashing the pairs and counting the frequencies of the pairs.\n Describe your approach to solving the problem. \n\n# Complexity
# Approach\nThrough this code, I am Hashing the pairs and counting the frequencies of the pairs.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(k^2+n)$$\n-- if we have k pairs in \'pick\', we are iterating, hashing and putting it in the map so it\'s $$O(k)$$ on average and best considering no collisions occur in the map.\n-- iterating the map is O(k) and for every k there might be another k pairs to search the matching hashcode for, $$O(k^2)$$\n-- iterating through the winners array is $$O(n)$$\n\n- Space complexity: $$O(k+n)$$\n-- The HashMap stores a unique hash code for each unique pair in \'pick\'. In the worst case, the number of unique pairs is O(k), so the space complexity for the HashMap is $$O(k)$$.\n-- The winners array has size n, so its space complexity is $$O(n)$$.\n\n# Code\n```\nclass Solution {\n    public int winningPlayerCount(int n, int[][] pick) {\n\n        // map stores the hashcode as key and the freq as the value\n        HashMap<Integer,Integer> m=new HashMap<>();\n\n        // iterate through the matrix and insert in the map\n        for (int p[]: pick ) {\n            int code = Arrays.hashCode(p);\n            m.put(code, m.getOrDefault(code, 0) + 1);\n        }\n\n        // declare winners array\n        int winners[]=new int[n];\n        // stores our answer\n        int count=0;\n\n        // iterate through the map\n        for(int e: m.keySet()){\n            // for every key that is the hascode find its equivalent array\n            for(int p[]:pick){\n                int code = Arrays.hashCode(p);\n                if(code == e){\n                    int player = p[0];\n                    int freq = m.get(e);\n                    // store the max freq occuring\n                    winners[player] = Math.max(winners[player],freq);\n                    break;\n                }\n                    \n            }    \n        }\n        // count the players which matches the condition\n        for(int i=0;i<n;i++){\n            if(winners[i]>i) count++;\n        }\n        return count;\n    }\n}\n```
['Array', 'Hash Table', 'Counting', 'Java']