Skip to content

Commit 1ebee6b

Browse files
committed
451
1 parent 56b4b58 commit 1ebee6b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def frequencySort(self, s: str) -> str:
3+
frequency = Counter(s)
4+
sorted_chars = sorted(frequency.items(), key = lambda x: -x[-1])
5+
result = ''.join([char * count for char, count in sorted_chars])
6+
return result

0 commit comments

Comments
 (0)