Counting with Bucket Sort | Python
Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def frequencySort(self, nums: List[int]) -> List[int]:\n  
# Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def frequencySort(self, nums: List[int]) -> List[int]:\n        count = Counter(nums) #O(n)\n        freq = [[] for _ in range(len(nums)+1)] #O(n)\n\n        for key,val in count.items(): #O(n)\n            freq[val].append(key)\n\n        res = []\n        for i,l in enumerate(freq): #O(nlogn)\n            for item in sorted(l,reverse=True):\n                res+=[item]*i\n        \n        return res\n\n```
['Array', 'Hash Table', 'Sorting', 'Python', 'Python3']