An element in an array is dominant if it is greater than all elements to its right. You will be given an array and your task will be to return a list of all dominant elements. For example:
```Haskell
solve([1,21,4,7,5]) = [21,7,5] because 21, 7 and 5 are greater than elments to their right. 
solve([5,4,3,2,1]) = [5,4,3,2,1]

Notice that the last element is always included.
```

More examples in the test cases.

Good luck!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def solve(arr):
	

Solutions:
def solve(arr):
	r = []
	for v in arr[::-1]:
		if not r or r[-1] < v:
			r.append(v)
	return r[::-1]


def solve(arr):
	return [a for (i, a) in enumerate(arr) if all((x < a for x in arr[i + 1:]))]


def solve(arr):
	return [a for (i, a) in enumerate(arr) if a > max(arr[i + 1:] + [0])]


def solve(arr):
	return [n for (i, n) in enumerate(arr) if n > max(arr[i + 1:], default=0)]


def solve(arr):
	a = set()
	for x in range(len(arr)):
		if arr != []:
			a.add(max(arr))
			arr = arr[arr.index(max(arr)) + 1:]
	return sorted(list(a), reverse=True)


def solve(arr):
	result = arr[-1:]
	for x in arr[-1::-1]:
		if x > result[-1]:
			result.append(x)
	return result[::-1]


def solve(arr):
	prev = -1
	for i in arr[-1::-1]:
		if i <= prev:
			arr.remove(i)
		else:
			prev = i
	return arr