Simple Python solution that beats 99.79% submissions

  • 0
    class Solution(object):
        def frequencySort(self, s):
            :type s: str
            :rtype: str
            if len(s) < 2:
                return s
            strlist = []
            for l in list(set(s)):
            return ''.join( sorted(strlist, key=lambda x:len(x), reverse=True) )

Log in to reply

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