(int[] nums)
| 4 | |
| 5 | class Solution { |
| 6 | public List<List<Integer>> threeSum(int[] nums) { |
| 7 | |
| 8 | Arrays.sort(nums); |
| 9 | List<List<Integer>> result = new ArrayList<>(); |
| 10 | |
| 11 | for (int i = 0; i<nums.length && nums[i] <=0; i++){ |
| 12 | if (i == 0 || nums[i] != nums[i-1]){ |
| 13 | twoSum2(nums, i, result); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | return result; |
| 18 | |
| 19 | } |
| 20 | |
| 21 | void twoSum2(int[] nums, int i, List<List<Integer>> result){ |
| 22 | int left = i+1; |