Python one-line O(n)


  • 0
    S
    return ''.join(itertools.chain.from_iterable(itertools.repeat(p[0], times=p[1]) for p in Counter(s).most_common()))
    

Log in to reply
 

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