Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
collections.Counter solution in Clear category for Frequency Sorting by David_Jones
from collections import Counter
def frequency_sorting(numbers):
c = Counter(numbers)
return sorted(numbers, key=lambda x: (-c[x], x))
June 12, 2019
Comments: