@@ -0,0 +1,914 @@
+import java.util.Arrays;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0A%0Aclass Solution %7B%0A    public List%3CList%3CInteger%3E%3E threeSum(int%5B%5D num) %7B%0A        Arrays.sort(num);%0A        List%3CList%3CInteger%3E%3E res = new LinkedList%3C%3E(); %0A        for (int i = 0; i %3C num.length - 2; i++) %7B%0A            if (i == 0 %7C%7C (i %3E 0 && num%5Bi%5D != num%5Bi - 1%5D)) %7B%0A                int lo = i + 1, hi = num.length - 1, sum = 0 - num%5Bi%5D;%0A                while (lo %3C hi) %7B%0A                    if (num%5Blo%5D + num%5Bhi%5D == sum) %7B%0A                        res.add(Arrays.asList(num%5Bi%5D, num%5Blo%5D, num%5Bhi%5D));%0A                        while (lo %3C hi && num%5Blo%5D == num%5Blo + 1%5D) lo++;%0A                        while (lo %3C hi && num%5Bhi%5D == num%5Bhi - 1%5D) hi--;%0A                        lo++; hi--;%0A                    %7D else if (num%5Blo%5D + num%5Bhi%5D %3C sum) lo++;%0A                    else hi--;%0A               %7D%0A            %7D%0A        %7D%0A        return res;%0A    %7D%0A%7D%0A

15. 3Sum