You are given an array of positive and negative integers and a number ```n``` and ```n > 1```. The array may have elements that occurs more than once.
Find all the combinations of n elements of the array that their sum are 0.
```python
arr = [1, -1, 2, 3, -2]
n = 3
find_zero_sum_groups(arr, n) == [-2, -1, 3] # -2 - 1 + 3 = 0
```
The function should ouput every combination or group in increasing order.

We may have more than one group:
```python
arr = [1, -1, 2, 3, -2, 4, 5, -3 ]
n = 3
find_zero_sum_groups(arr, n) == [[-3, -2, 5], [-3, -1, 4], [-3, 1, 2], [-2, -1, 3]]
```
In the case above the function should output a sorted 2D array.

The function will not give a group twice, or more, only once.

```python
arr = [1, -1, 2, 3, -2, 4, 5, -3, -3, -1, 2, 1, 4, 5, -3 ]
n = 3
find_zero_sum_groups(arr, n) == [[-3, -2, 5], [-3, -1, 4], [-3, 1, 2], [-2, -1, 3]]
```
If there are no combinations with sum equals to 0, the function will output an alerting message.

```python
arr = [1, 1, 2, 3]
n = 2
find_zero_sum_groups(arr, n) == "No combinations"
```
If the function receives an empty array will output an specific alert:
```python
arr = []
n = 2
find_zero_sum_groups(arr, n) == "No elements to combine"
```
As you have seen the solutions may have a value occurring only once.
Enjoy it!

Difficulty: EASY
Tags: Fundamentals

Data structures

Mathematics
Skill types: Data structures

Starter code:
def find_zero_sum_groups(arr, n):
	

Solutions:
from itertools import combinations

def find_zero_sum_groups(arr, n):
	combos = sorted((sorted(c) for c in combinations(set(arr), n) if sum(c) == 0))
	return combos if len(combos) > 1 else combos[0] if combos else 'No combinations' if arr else 'No elements to combine'


from itertools import combinations as comb

def find_zero_sum_groups(arr, n):
	if not arr:
		return 'No elements to combine'
	arr = list(set(arr))
	result = sorted((sorted(x) for x in set(comb(arr, n)) if sum(x) == 0))
	result = sorted((list(x) for x in set(map(tuple, result))))
	if not result:
		return 'No combinations'
	return result[0] if len(result) == 1 else result


from itertools import combinations

def find_zero_sum_groups(lst, n):
	if not lst:
		return 'No elements to combine'
	result = [list(c) for c in combinations(sorted(set(lst)), n) if sum(c) == 0]
	return (result[0] if len(result) == 1 else result) or 'No combinations'


from itertools import combinations

def find_zero_sum_groups(a, n):
	li = sorted(map(sorted, filter(lambda x: sum(x) == 0, combinations(set(a), n))))
	return li if len(li) > 1 else li[0] if li else 'No combinations' if a else 'No elements to combine'


from itertools import combinations as c

def find_zero_sum_groups(a, n):
	if not len(a):
		return 'No elements to combine'
	r = [sorted(x) for x in c(sorted(set(a)), n) if sum(x) == 0]
	return sorted(r) if len(r) > 1 else r[0] if len(r) else 'No combinations'


from itertools import combinations

def find_zero_sum_groups(arr, n):
	if not arr:
		return 'No elements to combine'
	res = [list(c) for c in combinations(sorted(set(arr)), n) if not sum(c)]
	if not res:
		return 'No combinations'
	if not res[1:]:
		return res[0]
	return res


from itertools import combinations

def find_zero_sum_groups(arr, n):
	if not arr:
		return 'No elements to combine'
	res = {c for c in combinations(set(arr), n) if not sum(c)}
	if len(res) == 1:
		return sorted(res.pop())
	return sorted(map(sorted, res)) if res else 'No combinations'


from itertools import combinations

def find_zero_sum_groups(arr, n):
	if not arr:
		return 'No elements to combine'
	else:
		results = [list(x) for x in combinations(sorted(set(arr)), n) if sum(x) == 0]
		if not results:
			return 'No combinations'
		elif len(results) == 1:
			return results[0]
		else:
			return results


from itertools import combinations

def find_zero_sum_groups(my_list, n):
	my_list = list(set(my_list))
	if len(my_list) == 0:
		return 'No elements to combine'
	subs = []
	sumsubs = []
	for i in range(n, n + 1):
		temp = [list(x) for x in combinations(my_list, i)]
		if len(temp) > 0:
			subs.extend(temp)
	subs.sort()
	for x in subs:
		x.sort()
		if sum(x) == 0 and x not in sumsubs:
			sumsubs.append(x)
	for x in sumsubs:
		x.sort()
	sumsubs.sort(key=lambda x: x[0])
	sumsubs.sort()
	if len(sumsubs) == 1:
		return sumsubs[0]
	if len(sumsubs) > 1:
		return sumsubs
	else:
		return 'No combinations'


from itertools import combinations as c

def find_zero_sum_groups(arr, n):
	a = sorted(set(arr))
	ans = []
	for i in c(a, n):
		if sum(i) == 0:
			ans.append(list(i))
	if not arr:
		return 'No elements to combine'
	if not ans:
		return 'No combinations'
	if len(ans) == 1:
		return ans[0]
	return ans