Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Sort Array by Element Frequency by Pouf
def frequency_sort(items):
sorting_key = lambda item: (-items.count(item), items.index(item))
sorted_items = sorted(items, key=sorting_key)
return sorted_items
June 28, 2020