All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : July 23, 2024
Last updated : July 23, 2024
Related Topics : N/A
Acceptance Rate : Unknown
class Solution:
def frequencySort(self, nums: List[int]) -> List[int]:
cnt = Counter(nums)
return sorted([x for x in nums], key=lambda x: (cnt[x], -x))