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 yoichi
from functools import reduce
def frequency_sort(items):
grouped = []
for i, v in enumerate(items):
if items.index(v) == i:
grouped.append([v] * items.count(v))
return reduce(list.__add__, sorted(grouped, key=len, reverse=True), [])
Dec. 7, 2018