Complete the function that returns an array of length `n`, starting with the given number `x` and the squares of the previous number. If `n` is negative or zero, return an empty array/list.

## Examples

```
2, 5  -->  [2, 4, 16, 256, 65536]
3, 3  -->  [3, 9, 81]
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def squares(x, n):
	

Solutions:
def squares(x, n):
	return [x ** 2 ** i for i in range(n)]


from itertools import accumulate, repeat

def squares(x, n):
	return list(accumulate(repeat(x, n), lambda a, _: a * a))


def squares(x, n):
	result = [x] if n > 0 else []
	for i in range(0, n - 1):
		result.append(result[-1] ** 2)
	return result


def squares(x, n):
	r = [x]
	return [r[-2] for i in range(n) if not r.append(r[-1] ** 2)]


from typing import List

def squares(x: int, n: int) -> List[int]:
	result = [x]
	for _ in range(1, n):
		result.append(pow(result[-1], 2))
	return result if n > 0 else []


def squares(x, n):
	return [x ** 2 ** k for k in range(n)]


def squares(x, n):
	fun = lambda x, n: x if n <= 1 else fun(x, n - 1) ** 2
	return [fun(x, i) for i in range(1, n + 1)]


def squares(x, n):
	if n < 0:
		return []
	return [] if n == 0 else [x] + squares(x ** 2, n - 1)


def squares(x, n):
	mx = [x]
	while len(mx) < n:
		mx.append(mx[-1] ** 2)
	return mx if n > 0 else []