In this Kata, you will be given an array of integers whose elements have both a negative and a positive value, except for one integer that is either only negative or only positive. Your task will be to find that integer. 

Examples:

`[1, -1, 2, -2, 3] => 3`

`3` has no matching negative appearance

`[-3, 1, 2, 3, -1, -4, -2] => -4`

`-4` has no matching positive appearance

`[1, -1, 2, -2, 3, 3] => 3`

(the only-positive or only-negative integer may appear more than once)

Good luck!

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

Solutions:
def solve(arr):
	return sum(set(arr))


def solve(arr):
	for a in arr:
		if -a not in arr:
			return a


def solve(a):
	return sum(set(a))


def solve(arr):
	return [i for i in arr if -i not in arr][0]


def solve(arr):
	for n in arr:
		if -n not in arr:
			return n


def solve(arr):
	for x in arr:
		if x and -x not in arr:
			return x


def solve(arr):
	for number in arr:
		if number * -1 in arr:
			pass
		else:
			return number


def solve(arr):
	special_set = set(arr)
	n = 0
	for i in list(special_set):
		n += i
	return n


def solve(arr):
	summa = 0
	dic = {}
	res = 0
	for i in arr:
		dic[i] = 0
		if -i in arr:
			dic[i] += 1
		else:
			dic[i] = 0
	for (key, value) in dic.items():
		if value == 0:
			res = key
	return res


def solve(arr):
	for i in arr:
		if -1 * i not in arr:
			return i


def solve(arr):
	result = 0
	for a in arr:
		if -a not in arr:
			return a


def solve(arr):
	return [x for x in arr if not -x in arr][0]


def solve(lst):
	return sum(set(lst))


def solve(lst):
	for num in lst:
		if -num not in lst:
			return num


def solve(arr):
	for num in arr:
		if not -num in arr:
			return num


def solve(arr: list) -> int:
	for i in range(len(arr)):
		if -arr[i] not in arr:
			return arr[i]


def solve(arr):
	nums = []
	unique = 0
	for i in arr:
		if -i in arr:
			nums.append(i)
		else:
			unique = i
	return unique


def solve(arr):
	arr = set(arr)
	lst = list(map(abs, arr))
	one = 0
	for i in range(len(lst)):
		if lst.count(lst[i]) == 1:
			one = lst[i]
	if one in arr:
		return one
	else:
		a = '-' + str(one)
		return int(a)


def solve(arr):
	result = []
	for i in arr:
		if arr.count(i) != arr.count(-i):
			result.append(i)
	return result[0]


def solve(arr):
	ls = [arr[0]]
	for n in arr[1:]:
		if -n in ls:
			ls.pop(ls.index(-n))
		else:
			ls.append(n)
	return ls[0]


def solve(arr):
	arr = sorted(arr)
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1]:
			return arr[i]
	return sum(arr)


def solve(arr):
	return [el for el in arr if -el not in arr][0]


def solve(arr):
	positive = sorted([x for x in arr if x >= 0])
	negative = sorted([x for x in arr if x < 0], reverse=True)
	longer_index = len(positive) <= len(negative)
	longer = [positive, negative][longer_index]
	for i in [positive, negative][not longer_index]:
		longer.remove(-i)
	return longer[0]


def solve(arr):
	rev = set((-x for x in arr))
	return [x for x in arr if abs(x) not in set(arr) or x not in rev][0]


def solve(arr):
	for i in arr:
		reverse = -i
		if reverse not in arr:
			return i


def solve(arr):
	for num in arr:
		if -num in arr:
			pass
		else:
			return num


def solve(arr):
	a = [i for i in arr if arr.count(i) != arr.count(-i)]
	return a[0]


def solve(arr):
	item = arr.pop()
	while -item in arr:
		arr.remove(-item)
		item = arr.pop()
	return item


def solve(arr):
	for (index, value) in enumerate(arr):
		if value * -1 in arr:
			continue
		else:
			return value


def solve(arr):
	for num in arr:
		if arr.count(num * -1) == 0:
			return num


def solve(arr):
	values = set()
	removed_values = set()
	for value in arr:
		if value in removed_values:
			continue
		opposite = value * -1
		if opposite in values:
			values.remove(opposite)
			removed_values.add(value)
			removed_values.add(opposite)
		else:
			values.add(value)
	return list(values)[0]


def solve(arr):
	result = arr[0]
	for i in range(len(arr)):
		pair = False
		for j in range(len(arr)):
			if arr[i] == -arr[j]:
				pair = True
		if not pair:
			result = arr[i]
	return result


def solve(arr):
	positive_set = set()
	negative_set = set()
	for num in arr:
		if num > 0:
			positive_set.add(num)
		else:
			negative_set.add(-num)
	number = positive_set.symmetric_difference(negative_set)
	popped_number = number.pop()
	return popped_number if popped_number in arr else -popped_number


def solve(arr):
	duplicates = [x for x in arr if arr.count(x) > 1]
	return duplicates[0] if duplicates else sum(arr)


def solve(numbers):
	for x in numbers:
		if not -x in numbers:
			return x


def solve(arr):
	while 1:
		number = arr[0]
		opposite_number = number * -1
		if opposite_number in arr:
			arr.remove(number)
			arr.remove(opposite_number)
		else:
			return arr[0]


def solve(arr):
	for n in arr:
		if n < 0 and abs(n) not in arr:
			return n
		elif n > 0 and -n not in arr:
			return n


def solve(arr):
	end = 0
	x = 0
	while end == 0:
		k = 1
		i = arr[x]
		for j in arr:
			if i == j * -1:
				k = 0
		if k == 1:
			ans = i
			end = 1
		x = x + 1
	return ans


def solve(arr):
	pos = [a for a in arr if a >= 0]
	neg = [a for a in arr if a < 0]
	neg = list(map(abs, neg))
	print(pos, neg)
	for element in arr:
		if not (abs(element) in pos and abs(element) in neg):
			return element


def match(vale, g):
	va = False
	for val in g:
		if val == -vale:
			va = True
	return va

def solve(g):
	m = []
	for val in g:
		if match(val, g) == False:
			m.append(val)
	return m[0]


def solve(arr):
	cleaned = list(set(arr))
	for i in cleaned:
		if not -i in cleaned:
			return i


def solve(a):
	for n in a:
		if -n in a:
			continue
		else:
			return n


def solve(arr):
	return list(set(filter(lambda x: arr.count(x) != arr.count(-x), arr)))[0]


def solve(arr):
	for i in range(0, len(arr)):
		if -arr[i] not in arr:
			return arr[i]


def solve(arr):
	arr.sort()
	l = len(arr)
	neg = []
	pos = []
	for i in arr:
		if i < 0:
			neg.append(i)
		else:
			pos.append(i)
	if len(neg) > len(pos):
		for i in neg:
			if abs(i) not in pos:
				return i
	else:
		for i in pos:
			if -i not in neg:
				return i


def solve(arr):
	return [value for value in arr if -value not in arr][0]


def solve(arr):
	arr = set(arr)
	return next(filter(lambda i: not sum(arr) - i, arr))


def solve(arr):
	arr = set(arr)
	for item in arr:
		if not sum(arr) - item:
			return item


def solve(arr):
	return list(set((x for x in arr if x * -1 not in arr)))[0]


def solve(arr):
	new_arr = [val for val in arr if not arr.count(-val)]
	return new_arr[0]


def solve(arr):
	arr = set(arr)
	sum = 0
	for i in arr:
		sum += i
	return sum


def solve(arr):
	for i in arr:
		if i and -i not in arr:
			return i


def solve(arr):
	for i in arr:
		if -1 * i in arr:
			continue
		else:
			return i


def solve(arr):
	a = 1
	for i in arr:
		if arr.count(i) > 1:
			a = arr.count(i)
	return sum(arr) / a


def solve(arr):
	arr.sort()
	while len(arr) >= 1:
		if arr[0] < 0 and abs(arr[0]) in arr:
			x = abs(arr[0])
			arr.remove(arr[0])
			arr.remove(x)
		else:
			return arr[0]


from collections import defaultdict

def solve(arr):
	d = defaultdict(int)
	for x in arr:
		d[abs(x)] += x
	return next((k if k in arr else -k for (k, v) in d.items() if v != 0))


def solve(ar):
	x = len(ar)
	i = 0
	temp = 0
	while i < x:
		c = 0
		char = ar[i]
		while c <= x - 1:
			if char == -ar[c]:
				i += 1
				break
			c += 1
		else:
			temp = char
			return temp
	return temp


def solve(ar):
	for item in ar:
		if -item not in ar:
			return item


def solve(arr):
	pos = set([x for x in arr if x > 0])
	neg = set([abs(x) for x in list([x for x in arr if x < 0])])
	if pos.issubset(neg):
		return (neg - pos).pop() * -1
	else:
		return (pos - neg).pop()


def solve(arr):
	for (idx, num) in enumerate(arr):
		if num in arr[:idx] + arr[idx + 1:]:
			return arr[idx]
	return sum(arr)


def solve(arr):
	pos = []
	neg = []
	for i in arr:
		if i < 0:
			neg.append(i)
		else:
			pos.append(i)
	for i in neg:
		if abs(i) not in pos:
			return i
			break
	for j in pos:
		if -j not in neg:
			return j
			break


def solve(arr):
	for (i, v) in enumerate(arr):
		isTrue = False
		for (k, kv) in enumerate(arr):
			if i == k:
				continue
			if v == arr[k] * -1:
				isTrue = True
				break
		if isTrue == False:
			return v


def solve(arr):
	return sum(arr) / arr.count(max(arr, key=arr.count))


def solve(arr):
	parr = []
	narr = []
	for i in arr:
		if i < 0:
			narr.append(i)
		else:
			parr.append(i)
	res = 0
	for a in narr:
		if abs(a) not in parr:
			res = a
	for b in parr:
		if b * -1 not in narr:
			res = b
	return res


def solve(arr):
	check = []
	for i in arr:
		if -i not in arr:
			return i


from collections import Counter

def solve(arr):
	return sum(arr) / Counter(arr).most_common(1)[0][1]


def solve(arr):
	abs_arr = [abs(n) for n in arr]
	for n in set(abs_arr):
		if not (n in arr and -n in arr):
			return arr[abs_arr.index(n)]


def solve(arr):
	for i in arr:
		(m, s) = (0, -i)
		for j in arr:
			if s == j:
				m = 1
		if m == 0:
			return i


def solve(arr):
	for num in arr:
		if num > 0 and -num not in arr:
			return num
		elif num < 0 and num - num * 2 not in arr:
			return num


def solve(arr):
	dict = {}
	for a in arr:
		if abs(a) not in dict:
			dict[abs(a)] = a
		elif dict[abs(a)] == a:
			return a
			break
		else:
			dict[abs(a)] = a + dict[abs(a)]
	for v in list(dict.values()):
		if v != 0:
			return v


def solve(arr):
	newArr = []
	for x in arr:
		if x * -1 not in arr:
			return x


def solve(arr):
	negative = set([i for i in arr if i < 0])
	positive = set([i for i in arr if i > 0])
	res = None
	for i in negative:
		if i * -1 not in positive:
			res = i
	for i in positive:
		if i * -1 not in negative:
			res = i
	return res


def solve(arr):
	for i in range(len(arr)):
		count = 0
		if arr.count(arr[i]) > 1:
			return arr[i]
		for j in range(len(arr)):
			if arr[i] == -arr[j]:
				count += 1
		if count != 1:
			return arr[i]


from collections import Counter

def solve(arr):
	c = Counter(arr)
	for (k, v) in c.items():
		if k * -1 not in c.keys():
			return k


import collections

def solve(arr):
	count = collections.Counter(arr)
	for number in arr:
		if not count[-number]:
			return number


def solve(arr):
	for val in arr:
		if -1 * val not in arr:
			return val


def solve(arr):
	sum = 0
	times = 0
	ele = {}
	for i in arr:
		if i in ele:
			ele[i] = ele[i] + i
		else:
			ele[i] = i
		sum = sum + i
	for (k, v) in ele.items():
		if v == sum:
			if -k not in arr:
				times = sum / k
	if times > 1:
		sum = sum / times
	return sum


def solve(arr):
	for num in arr:
		if arr.count(num) > arr.count(-num):
			return num
		elif arr.count(-num) > arr.count(num):
			return -num


def solve(arr):
	for (i, el) in enumerate(arr):
		if arr.count(el * -1) == 0:
			return el


def solve(arr):
	return sum(dict.fromkeys(arr))


def solve(arr):
	for i in arr:
		n = 0
		for j in arr:
			n += 1
			if i + j == 0:
				break
			if len(arr) == n and i + j != 0:
				return i


def solve(arr):
	while len(set(arr)) > 1:
		for i in range(len(arr) - 1):
			if arr.count(-arr[i]):
				arr.remove(-arr[i])
				arr.remove(arr[i])
				break
	return list(set(arr))[0]


def solve(arr):
	for i in range(0, len(arr)):
		num = arr[i]
		reversenumber = -num
		found = False
		for index in range(0, len(arr)):
			if i == index:
				continue
			if reversenumber == arr[index]:
				found = True
				break
		if found == False:
			return num