Given an `array` of digital numbers, return a new array of length `number` containing the last even numbers from the original array (in the same order). The original array will be not empty and will contain at least "number" even numbers.

For example:
```
([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) => [4, 6, 8]
([-22, 5, 3, 11, 26, -6, -7, -8, -9, -8, 26], 2) => [-8, 26]
([6, -25, 3, 7, 5, 5, 7, -3, 23], 1) => [6]

```

Difficulty: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

Starter code:
def even_numbers(arr,n):
	

Solutions:
def even_numbers(arr, n):
	return [i for i in arr if i % 2 == 0][-n:]


def even_numbers(arr, n):
	result = []
	a = list(reversed(arr))
	for number in a:
		if n == 0:
			break
		if number % 2 == 0:
			result.append(number)
			n -= 1
	return list(reversed(result))


def even_numbers(arr, n):
	return list(filter(lambda n: n % 2 == 0, arr))[-n:]


def even_numbers(arr, n):
	s = [num for num in arr if num % 2 == 0]
	return s[-n:]


def even_numbers(arr, n):
	return [x for x in arr if x % 2 == 0][-n:]


def even_numbers(arr, n):
	return [a for a in arr if a % 2 < 1][-n:]


def even_numbers(arr, n):
	return [even for even in arr if even % 2 == 0][-n:]


from typing import List

def even_numbers(arr: List[int], n: int) -> List[int]:
	res = []
	for a in reversed(arr):
		if a % 2 == 0:
			res.insert(0, a)
			if len(res) == n:
				return res


def even_numbers(arr, n):
	even = []
	for i in arr:
		if i % 2 == 0:
			even.append(i)
	return even[len(even) - n:len(arr)]


def even_numbers(arr, n):
	return list(filter(lambda x: x % 2 == 0, arr))[-n:len(arr)]


def even_numbers(arr, n):
	return list(filter(lambda n: not n & 1, arr))[-n:]


def even_numbers(lst, n):
	return [num for num in lst if not num % 2][-n:]


even_numbers = lambda a, n: [e for e in a if 1 - e % 2][-n:]


def even_numbers(arr, n):
	return [a for a in arr if a % 2 == 0][-n:]


def even_numbers(arr, n):
	return [i for i in arr if not i % 2][-n:]


def even_numbers(arr, n):
	lista = []
	for i in arr[::-1]:
		if i % 2 == 0:
			lista.append(i)
			if len(lista) == n:
				return lista[::-1]


def even_numbers(arr, n):
	x = []
	for i in arr[::-1]:
		if len(x) < n and i % 2 == 0:
			x.append(i)
		else:
			pass
	return x[::-1]


def even_numbers(arr, n):
	return list(filter(lambda x: not x % 2, arr))[-n:]


def even_numbers(arr, n):
	if not arr or n == 0:
		return []
	if arr[-1] % 2 == 0:
		v = n - 1
		tail = [arr[-1]]
	else:
		v = n
		tail = []
	return even_numbers(arr[:-1], v) + tail


def even_numbers(arr, n):
	return [i for i in arr if i & 1 ^ 1][-n:]


def even_numbers(arr, n):
	return [number for number in arr if number % 2 == 0][::-1][:n][::-1]


def even_numbers(array, requiredResultLength):
	return [number for number in array if not number % 2][-requiredResultLength:]


def even_numbers(arr, n):
	even = [a for a in arr if not a % 2]
	return even[len(even) - n:]


def even_numbers(arr, n):
	arr = arr[::-1]
	ans = []
	for x in arr:
		if x % 2 == 0:
			ans.append(x)
			if len(ans) == n:
				return ans[::-1]


def even_numbers(arr, n):
	x = []
	for i in range(len(arr)):
		if arr[i] % 2 == 0:
			x.append(arr[i])
	res = len(x) - n
	return x[res:]


def even_numbers(arr, n):
	arr = arr[::-1]
	number = []
	for x in range(len(arr)):
		if arr[x] % 2 == 0:
			if len(number) < n:
				number.append(arr[x])
			else:
				break
	return number[::-1]


def even_numbers(arr, n):
	return [x for x in arr if not x % 2][::-1][:n][::-1]


def even_numbers(arr, n):
	return list([e for e in arr if e % 2 == 0])[-n:]


def even_numbers(arr, n):
	return [even_num for even_num in arr if even_num % 2 == 0][-n:]


def even_numbers(arr, n):
	newarr = []
	for i in arr:
		if i % 2 == 0:
			newarr.append(i)
	return newarr[-n:]


def even_numbers(arr, n):
	result = []
	for i in range(len(arr) - 1, -1, -1):
		if arr[i] % 2 == 0:
			result.insert(0, arr[i])
			if len(result) == n:
				return result
	return result


def even_numbers(arr, n):
	res = []
	for elem in arr[::-1]:
		if elem % 2 == 0:
			res.insert(0, elem)
			if len(res) == n:
				break
	return res


def even_numbers(arr, n):
	last_n_even_numbers = list()
	for num in arr[::-1]:
		if not num % 2:
			last_n_even_numbers.append(num)
			if len(last_n_even_numbers) == n:
				return last_n_even_numbers[::-1]


def even_numbers(arr, n):
	out = []
	count = 0
	for el in arr[::-1]:
		if el % 2 == 0 and count < n:
			out.append(el)
			count += 1
	return out[::-1]


def even_numbers(array, number):
	a = []
	index = len(array) - 1
	while len(a) < number:
		if array[index] % 2 == 0:
			a.append(array[index])
		index -= 1
	return a[::-1]


def even_numbers(arr, n):
	res = [i for i in arr if i % 2 == 0]
	while len(res) > n:
		res.pop(0)
	return res


def even_numbers(A, n):
	return [e for e in A if not e % 2][-n:]


def even_numbers(arr, n):
	ans = []
	for i in arr[::-1]:
		if n == 0:
			break
		if i % 2 == 0:
			ans.append(i)
			n -= 1
	return ans[::-1]


def even_numbers(arr, n):
	numberlist = []
	for eachnumber in arr[::-1]:
		if eachnumber % 2 == 0:
			numberlist.append(eachnumber)
			if len(numberlist) == n:
				numberlist.reverse()
				return numberlist


def even_numbers(arr, n):
	evens = []
	for i in arr:
		if i % 2 == 0:
			evens.append(i)
	if len(evens) == n:
		return evens
	else:
		del evens[:-n]
		return evens


def even_numbers(arr, n):
	res = []
	for i in range(1, len(arr) + 1):
		if arr[-i] % 2 == 0:
			res.append(arr[-i])
			if len(res) == n:
				break
	return res[::-1]


def even_numbers(arr, n):
	x = [k for k in arr if k % 2 == 0]
	while len(x) > n:
		for k in x:
			x.remove(k)
			break
	return x


def even_numbers(arr, n):
	result = []
	for x in reversed(arr):
		if x % 2 == 0:
			result.append(x)
			if len(result) == n:
				break
	return list(reversed(result))


def even_numbers(arr, n):
	x = -1
	result = []
	while n > 0:
		if arr[x] % 2 == 0:
			result.append(arr[x])
			n -= 1
			x -= 1
		else:
			x -= 1
	return list(reversed(result))


def even_numbers(a, n):
	return [x for x in a[::-1] if x % 2 == 0][:n][::-1]


def even_numbers(arr, n):
	return list(reversed(list(reversed(list(filter(lambda x: x % 2 == 0, arr))))[:n]))


def even_numbers(arr, n):
	result = []
	myList = arr
	evensList = [x for x in myList if x % 2 == 0]
	evensList = evensList[::-1]
	for i in range(0, n):
		result.append(evensList[i])
	return result[::-1]


def even_numbers(arr, n):
	newl = []
	r = arr[::-1]
	for i in r:
		if i % 2 == 0:
			newl.append(i)
			if len(newl) == n:
				return newl[::-1]
			else:
				continue


def even_numbers(arr, n):
	res = []
	for ele in reversed(arr):
		if ele % 2 == 0:
			res.append(ele)
	return list(reversed(res[:n]))


def even_numbers(arr, n):
	arr.reverse()
	output = []
	i = 0
	while len(output) < n:
		if arr[i] % 2 == 0:
			output.append(arr[i])
		i += 1
	output.reverse()
	return output


def even_numbers(arr, n):
	s = []
	for e in arr:
		if e % 2 == 0:
			s.append(e)
	s1 = s[:-n - 1:-1]
	s2 = s1[::-1]
	return s2


def even_numbers(arr, n):
	return [k for k in arr if k % 2 == 0][-n:]


def even_numbers(arr, n):
	output = []
	for num in arr:
		if num % 2 == 0:
			output.append(num)
	return output[-n:]


def even_numbers(arr, n):
	li = [x for x in arr if x % 2 == 0]
	li = li[::-1]
	result = li[:n]
	return result[::-1]


even_numbers = lambda lst, k: [n for n in lst if not n & 1][-k:]


def even_numbers(arr: list, n: int):
	arr.reverse()
	arr = [i for i in arr if not i % 2]
	arr = arr[:n]
	arr.reverse()
	return arr


def even_numbers(arr, n):
	evenlist = []
	for x in arr:
		if x % 2 == 0:
			evenlist.append(x)
	return evenlist[-n:]


def even_numbers(arr, length):
	return [n for n in arr if n % 2 == 0][-length:]


def even_numbers(arr, n):
	lst = [num for (i, num) in enumerate(arr) if not num % 2]
	return [lst[i] for i in range(len(lst) - n, len(lst))]


def even_numbers(arr, n):
	res = [x for x in arr if not x & 1]
	return res[-n:]


def even_numbers(arr, n):
	even_nums = list(filter(lambda x: x % 2 == 0, arr))
	return even_nums[-n:]


def even_numbers(arr, n):
	list = []
	for number in reversed(arr):
		if number % 2 == 0:
			list.append(number)
		if len(list) == n:
			return list[::-1]


def even_numbers(arr, n):
	pass
	e = []
	l = len(e)
	for i in range(0, len(arr)):
		if arr[i] % 2 == 0:
			e.append(arr[i])
	return e[l - n:]


def even_numbers(arr, num):
	new = []
	for i in arr:
		if i % 2 == 0:
			new.append(i)
	return new[-num:]


def even_numbers(arr, n):
	p = arr[::-1]
	z = []
	for i in p:
		if i % 2 == 0:
			z.append(i)
	c = len(z) - n
	for f in range(0, c):
		z.pop()
	return z[::-1]


def even_numbers(arr, n):
	even_numbers_in_arr = []
	new_even_numbers = []
	for number in arr:
		if number % 2 == 0:
			even_numbers_in_arr.append(number)
	even_numbers_in_arr.reverse()
	for i in range(n):
		new_even_numbers.append(even_numbers_in_arr[i])
	new_even_numbers.reverse()
	return new_even_numbers


def even_numbers(arr, n):
	new_arr = []
	even = []
	for i in arr:
		if i % 2 == 0:
			new_arr.append(i)
	for j in range(n):
		even.append(new_arr[-(j + 1)])
	even.reverse()
	return even


def even_numbers(arr, n):
	evens_arr = [x for x in arr if x % 2 == 0]
	return evens_arr[len(evens_arr) - n:]


def even_numbers(arr, n):
	even = []
	for number in arr[::-1]:
		if number % 2 == 0:
			even.append(number)
			if len(even) == n:
				break
	return even[::-1]


def even_numbers(arr, n):
	result = []
	for num in arr[::-1]:
		if len(result) < n:
			if num % 2 == 0:
				result.append(num)
	return result[::-1]


def even_numbers(arr, n):
	l = []
	counter = 1
	while len(l) != n:
		if arr[-counter] % 2 == 0:
			l.append(arr[-counter])
		counter += 1
	return l[::-1]


def even_numbers(arr, n):
	new = [c for c in arr if c % 2 == 0]
	return new[-n:]


def even_numbers(arr, n):
	lst = []
	for i in arr:
		if i % 2 == 0:
			lst.append(i)
	print(lst)
	lst.reverse()
	print(lst)
	lst = lst[0:n]
	print(lst)
	lst.reverse()
	return lst


def even_numbers(arr, n):
	return list(reversed([x for x in arr if x % 2 == 0][-1:-(n + 1):-1]))


def even_numbers(arr, n):
	even_steven = []
	for element in arr[::-1]:
		if element % 2 == 0 and len(even_steven) < n:
			even_steven.append(element)
	return even_steven[::-1]


def even_numbers(arr, n):
	A = []
	while len(A) < n and arr:
		temp = arr.pop()
		if temp % 2 == 0:
			A = [temp] + A
	return A


def even_numbers(arr, n):
	cont = 0
	m = []
	x = -1
	while cont < n:
		if arr[x] % 2 == 0:
			m.append(arr[x])
			cont += 1
		x = x - 1
	m.reverse()
	return m


def even_numbers(arr, n):
	res = []
	cnt = 0
	idx = len(arr) - 1
	while cnt != n:
		if arr[idx] % 2 == 0:
			cnt += 1
			res = [arr[idx]] + res
		idx = idx - 1
	return res