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 wbl4126
def frequency_sort(items):
cnt = sorted(
[[i, -items.index(i), items.count(i)] for i in items],
key=lambda x: (x[2], x[1]),
reverse=True,
)
return [i[0] for i in cnt]
March 6, 2020
Comments: