<qiyuangong>015_3Sum_2.py
def threeSum( nums):
    res = []
    nums.sort()
    ls = len(nums)
    for i in range(ls - 2):
        if i > 0 and nums[i] == nums[i - 1]:
            continue
        j = i + 1
        k = ls - 1
        while j < k:
            curr = nums[i] + nums[j] + nums[k]
            if curr == 0:
                res.append([nums[i], nums[j], nums[k]])
                while j < k and nums[j] == nums[j + 1]:
                    j += 1
                while j < k and nums[k] == nums[k - 1]:
                    k -= 1
                j += 1
                k -= 1
            elif curr < 0:
                j += 1
            else:
                k -= 1
    return res
def sample_funcname ( var_0 ) :
    var_1 = [ ]
    var_0.sort ( )
    var_4 = len ( var_0 )
    for var_7 in range ( var_4 - 2 ) :
        if var_7 > 0 and var_0 [ var_7 ] == var_0 [ var_7 - 1 ] :
            continue
        var_10 = var_7 + 1
        var_11 = var_4 - 1
        while var_10 < var_11 :
            var_12 = var_0 [ var_7 ] + var_0 [ var_10 ] + var_0 [ var_11 ]
            if var_12 == 0 :
                var_1.append ( [ var_0 [ var_7 ] , var_0 [ var_10 ] , var_0 [ var_11 ] ] )
                while var_10 < var_11 and var_0 [ var_10 ] == var_0 [ var_10 + 1 ] :
                    var_10 += 1
                while var_10 < var_11 and var_0 [ var_11 ] == var_0 [ var_11 - 1 ] :
                    var_11 -= 1
                var_10 += 1
                var_11 -= 1
            elif var_12 < 0 :
                var_10 += 1
            else :
                var_11 -= 1
    return var_1
