Skip to content

Commit ad99e6d

Browse files
committed
2021-04-04
1 parent 1b4af60 commit ad99e6d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution(object):
2+
def frequencySort(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: List[int]
6+
"""
7+
from collections import Counter
8+
dic = Counter(nums)
9+
10+
return sorted(nums, key = lambda x:(dic[x], -x))

0 commit comments

Comments
 (0)