<doocs>0015.3Sum_1.py
def threeSum( nums: List[int]) -> List[List[int]]:
    n, res = len(nums), []
    if n < 3:
        return res
    nums.sort()
    for i in range(n - 2):
        if nums[i] > 0:
            break
        if i > 0 and nums[i] == nums[i - 1]:
            continue
        j, k = i + 1, n - 1
        while j < k:
            if nums[i] + nums[j] + nums[k] == 0:
                res.append([nums[i], nums[j], nums[k]])
                j += 1
                k -= 1
                while j < n and nums[j] == nums[j - 1]:
                    j += 1
                while k > i and nums[k] == nums[k + 1]:
                    k -= 1
            elif nums[i] + nums[j] + nums[k] < 0:
                j += 1
            else:
                k -= 1
    return res
def sample_funcname ( var_0 : List [ int ] ) -> List [ List [ int ] ] :
    var_4 , var_5 = len ( var_0 ) , [ ]
    if var_4 < 3 :
        return var_5
    var_0.sort ( )
    for var_10 in range ( var_4 - 2 ) :
        if var_0 [ var_10 ] > 0 :
            break
        if var_10 > 0 and var_0 [ var_10 ] == var_0 [ var_10 - 1 ] :
            continue
        var_13 , var_14 = var_10 + 1 , var_4 - 1
        while var_13 < var_14 :
            if var_0 [ var_10 ] + var_0 [ var_13 ] + var_0 [ var_14 ] == 0 :
                var_5.append ( [ var_0 [ var_10 ] , var_0 [ var_13 ] , var_0 [ var_14 ] ] )
                var_13 += 1
                var_14 -= 1
                while var_13 < var_4 and var_0 [ var_13 ] == var_0 [ var_13 - 1 ] :
                    var_13 += 1
                while var_14 > var_10 and var_0 [ var_14 ] == var_0 [ var_14 + 1 ] :
                    var_14 -= 1
            elif var_0 [ var_10 ] + var_0 [ var_13 ] + var_0 [ var_14 ] < 0 :
                var_13 += 1
            else :
                var_14 -= 1
    return var_5
