In this Kata, you will sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value. 


More examples in test cases. 

Good luck!

Please also try [Simple time difference](https://www.codewars.com/kata/5b76a34ff71e5de9db0000f2)

Source: codewars | Difficulty: EASY
Tags: Sorting

Data structures

Starter code: def solve(arr):
	

Solutions:
from collections import Counter

def solve(a):
	c = Counter(a)
	return sorted(a, key=lambda k: (-c[k], k))


def solve(arr):
	return sorted(arr, key=lambda x: (-arr.count(x), x))


def solve(arr):
	return sorted(sorted(arr), key=lambda n: arr.count(n), reverse=True)


def solve(arr):
	freq = {n: -arr.count(n) for n in set(arr)}
	return sorted(sorted(arr), key=freq.get)


from collections import Counter

def solve(xs):
	fs = Counter(xs)
	return sorted(xs, key=lambda x: (-fs[x], x))


from collections import Counter

def solve(arr):
	c = Counter(arr)
	return sorted(arr, key=lambda x: (-c[x], x))


def solve(arr):
	return sorted(arr, key=lambda x: (arr.count(x), -x), reverse=True)


def solve(array):
	return sorted(sorted(array), key=array.count, reverse=True)


from collections import Counter
from itertools import groupby

def unpack_fun(l):
	return sorted([k for (k, v) in l for i in range(v)])

def solve(arr):
	out_lst = []
	l = [list(v) for (k, v) in groupby(Counter(arr).most_common(), key=lambda x: x[1])]
	for v in l:
		out_lst.extend(unpack_fun(v))
	return out_lst


def solve(arr):
	c = []
	answer = []
	for n in range(0, max(arr) + 1):
		c.append(arr.count(n))
	x = sorted(c, reverse=True)
	for i in x:
		m = i
		while m > 0:
			answer.append(c.index(i))
			m -= 1
		c[c.index(i)] = -1
	return answer