Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
(-items.count(x), items.index(x)) solution in Clear category for Sort Array by Element Frequency by flpo
def frequency_sort(items):
return sorted(items, key=lambda x: (-items.count(x), items.index(x)))
Dec. 7, 2018
Comments: