@@ -0,0 +1,1166 @@
+import org.junit.Test;%0A%0Aimport java.util.Arrays;%0A%0Aimport static junit.framework.Assert.assertEquals;%0A%0A/**%0A * https://leetcode.com/problems/3sum-smaller/%0A */%0Apublic class Solution %7B%0A    public int threeSumSmaller(int%5B%5D nums, int target) %7B%0A        int counter = 0;%0A        if (nums.length %3C 3) %7B%0A            return counter;%0A        %7D%0A        Arrays.sort(nums);%0A%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            int j = i + 1, k = nums.length - 1;%0A            while (j %3C k) %7B%0A                if (nums%5Bi%5D + nums%5Bj%5D + nums%5Bk%5D %3C target) %7B%0A                    counter += k - j;%0A                    j++;%0A                %7D else %7B%0A                    k--;%0A                %7D%0A            %7D%0A        %7D%0A        return counter;%0A    %7D%0A%0A    @Test%0A    public void test1() %7B%0A        int output = threeSumSmaller(new int%5B%5D%7B-2, 0, 1, 3%7D, 2);%0A        assertEquals(2, output);%0A    %7D%0A%0A    @Test%0A    public void test2() %7B%0A        int output = threeSumSmaller(new int%5B%5D%7B2, 0, 0, 2, -2%7D, 2);%0A        assertEquals(5, output);%0A    %7D%0A%0A    @Test%0A    public void test3() %7B%0A        int output = threeSumSmaller(new int%5B%5D%7B0, -4, -1, 1, -1, 2%7D, -5);%0A        assertEquals(1, output);%0A    %7D%0A%7D%0A

three sum smaller 7ms