Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Sort Array by Element Frequency by erewhon
import collections
def frequency_sort(items):
counts = collections.Counter([i for i in items]).most_common()
result = []
for i in range(len(counts)):
result += [counts[i][0]] * counts[i][1]
return result
July 7, 2020