One-liner python O(n)


  • -1
    R
    class Solution(object):
        def frequencySort(self, s):
            return ''.join(map(lambda x: x[0]*x[1], sorted(list(dict(collections.Counter(s)).items()), key=lambda x: -x[1])))
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.