@@ -0,0 +1,841 @@
+public class Solution %7B%0A    public int threeSumClosest(int%5B%5D nums, int target) %7B%0A        if(nums == null %7C%7C nums.length %3C 3)%7B%0A            return Integer.MAX_VALUE;%0A        %7D%0A        Arrays.sort(nums);%0A        int closest = Integer.MAX_VALUE;%0A        for(int i = 0; i %3C nums.length - 2; i ++)%7B%0A            int left = i + 1, right = nums.length - 1;%0A            while(left %3C right)%7B%0A                int sum = nums%5Bi%5D + nums%5Bleft%5D + nums%5Bright%5D;%0A                if(sum == target)%7B%0A                    return sum;%0A                %7Delse if(sum %3C target)%7B%0A                    left++;%0A                %7Delse%7B%0A                    right--;                    %0A                %7D%0A                closest = Math.abs((long)sum - (long)target) %3C Math.abs((long)closest - (long)target)? sum : closest;%0A            %7D%0A        %7D%0A        return closest;%0A    %7D%0A%7D

Q16 3Sum Closest