def solve(arr):
    """
    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.
    :param arr: array of positive and negative integers.
    :return: find integer that only has a negative and not a positive or other way around.
    """
    return next(x for x in arr if abs(x) not in arr or -x not in arr)