Complete the method which returns the number which is most frequent in the given input array. If there is a tie for most frequent number, return the largest number among them.

Note: no empty arrays will be given.


## Examples

```
[12, 10, 8, 12, 7, 6, 4, 10, 12]              -->  12
[12, 10, 8, 12, 7, 6, 4, 10, 12, 10]          -->  12
[12, 10, 8, 8, 3, 3, 3, 3, 2, 4, 10, 12, 10]  -->   3
```

Difficulty: EASY
Starter code: def highest_rank(arr):
	

Solutions:
from collections import Counter

def highest_rank(arr):
	if arr:
		c = Counter(arr)
		m = max(c.values())
		return max((k for (k, v) in c.items() if v == m))


def highest_rank(arr):
	return sorted(arr, key=lambda x: (arr.count(x), x))[-1]


def highest_rank(arr):
	return max(sorted(arr, reverse=True), key=arr.count)


def highest_rank(arr):
	best = 0
	occs = 0
	for item in arr:
		times = arr.count(item)
		if times > occs:
			best = item
			occs = times
		elif times == occs:
			if best < item:
				best = item
	return best


def highest_rank(arr):
	frequent = {}
	for i in arr:
		if i not in frequent:
			frequent[i] = 0
		frequent[i] += 1
	ordered_inv = sorted(list(frequent.items()), key=lambda x: (x[1], x[0]), reverse=True)
	return ordered_inv[0][0]


def highest_rank(a):
	b = set(a)
	c = 0
	for i in b:
		d = a.count(i)
		if d > c or (d == c and i > m):
			c = d
			m = i
	return m


from collections import Counter

def highest_rank(arr):
	return max(Counter(arr).items(), key=lambda x: [x[1], x[0]])[0]


from collections import Counter

def highest_rank(arr):
	c = Counter(arr)
	return max(c, key=lambda x: (c[x], x))


def highest_rank(arr):
	print(arr)
	freq = {}
	for num in arr:
		if num in freq:
			freq[num] += 1
		else:
			freq[num] = 1
			mx = [0, 0]
	maxes = []
	for num in freq:
		if freq[num] > mx[1]:
			mx[0] = num
			mx[1] = freq[num]
			maxes = [num]
		elif freq[num] == mx[1]:
			maxes.append(num)
	return max(maxes)