16. 3Sum Closest

class Solution(object):
    def threeSumClosest(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        result, diff=0,sys.maxint
        nums.sort()
        
        for i in xrange(0,len(nums)-2):
            if i>0 and nums[i]==nums[i-1]:
                continue
            left, right=i+1,len(nums)-1
            while left

你可能感兴趣的:(16. 3Sum Closest)