(array)
return res
:param array: List[int]
    :return: Set[ Tuple[int, int, int] ]
:param array: List[int]
    :return: Set[ Tuple[int, int, int] ]
: param array : List [ int ] : return : Set [ Tuple [ int int int ] ]
def three_sum(array):
    """
    :param array: List[int]
    :return: Set[ Tuple[int, int, int] ]
    """
    res = set()
    array.sort()
    for i in range(len(array) - 2):
        if i > 0 and array[i] == array[i - 1]:
            continue
        l, r = i + 1, len(array) - 1
        while l < r:
            s = array[i] + array[l] + array[r]
            if s > 0:
                r -= 1
            elif s < 0:
                l += 1
            else:
                # found three sum
                res.add((array[i], array[l], array[r]))

                # remove duplicates
                while l < r and array[l] == array[l + 1]:
                    l += 1

                while l < r and array[r] == array[r - 1]:
                    r -= 1

                l += 1
                r -= 1
    return res
def three_sum ( array ) : res = set ( ) array . sort ( ) for i in range ( len ( array ) - 2 ) : if i > 0 and array [ i ] == array [ i - 1 ] : continue l , r = i + 1 , len ( array ) - 1 while l < r : s = array [ i ] + array [ l ] + array [ r ] if s > 0 : r -= 1 elif s < 0 : l += 1 else : # found three sum res . add ( ( array [ i ] , array [ l ] , array [ r ] ) ) # remove duplicates while l < r and array [ l ] == array [ l + 1 ] : l += 1 while l < r and array [ r ] == array [ r - 1 ] : r -= 1 l += 1 r -= 1 return res