Lonely Integer

Published by Mubashir Hassan in

You are given a list of integers having both negative and positive values, except for one integer which can be negative or positive. Create a function to find out that integer.

Examples

lonely_integer([1, -1, 2, -2, 3]) ➞ 3
# 3 has no matching negative appearance.

lonely_integer([-3, 1, 2, 3, -1, -4, -2]) ➞ -4
# -4 has no matching positive appearance.

lonely_integer([-9, -105, -9, -9, -9, -9, 105]) ➞ -9

Notes

N/A

Watch a quick demo on how Edabit works.