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 ssk8
from collections import Counter
def frequency_sort(items):
freq, sorted_items = Counter(items), []
for item in items:
if item not in sorted_items and freq[item] == max(freq.values()):
sorted_items.extend([item]*freq[item])
del freq[item]
return sorted_items
Dec. 26, 2018