kucheasysa

Algoverse_adesh_12

Jun 9th, 2024
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. class Solution:
  2.     def frequencySort(self, s: str) -> str:
  3.         count = Counter(s)
  4.  
  5.         sort = sorted(count, key=count.get, reverse=True)
  6.         a = ''
  7.         for i in sort:
  8.             a += i * count[i]
  9.         return a  
Advertisement
Add Comment
Please, Sign In to add comment