Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Frequency Sorting by rybld2
def frequency_sorting(numbers):
dico={}
for x in numbers:
dico[x] = dico.get(x, 0) + 1
l = sorted([(x, dico[x]) for x in dico] , key=lambda t: t[0], reverse=False)
l = sorted(l, key=lambda t: t[1], reverse=True)
res=[]
for x in l :
for y in range(x[1]):
res+=[x[0]]
return res
Jan. 2, 2021
Comments: