Ruby Solution Using Nested Hashmaps and Sets
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```ruby []\n# @param {Integer} n\n# @param {Integer[][]} pick\n# @return {Integer}\ndef winning_player_count(n, pick)\n    winningPlayers = Set.new\n    playerMap = {}\n    pick.each do |player,ballColor|\n        if(!playerMap.key?(player))\n            playerMap[player] = {}\n        end\n        playerDict = playerMap[player]\n        if(!playerDict.key?(ballColor))\n            playerDict[ballColor] = 0\n        end\n        nextFreq = playerDict[ballColor] + 1\n        if(nextFreq > player)\n            winningPlayers.add(player)\n        end\n        playerDict[ballColor] = nextFreq\n    end\n    numWinners = winningPlayers.size\n    return numWinners\nend\n```
['Array', 'Hash Table', 'Counting', 'Ruby']