Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
rearrange then sort solution in Clear category for Sort Array by Element Frequency by Sioul
def frequency_sort(items):
# gather each value keeping the order of first occurence
items=sorted(items,key=items.index)
# now the actual sort, values won't be mixed thanks to the previous rearrangement
items=sorted(items,key=items.count, reverse=True)
return items
Sept. 10, 2019
Comments: