See More

class Solution { public List> threeSum(int[] nums) { Set> set = new HashSet<>(); Arrays.sort(nums); for (int i=0; i temp = new ArrayList<>(); temp.add(nums[i]); temp.add(nums[j]); temp.add(nums[idx]); set.add(temp); } } } List> ans = new ArrayList<>(); ans.addAll(set); return ans; } private int findBinary(int[] nums, int start, int end, int target) { while (start <= end) { int mid = (start + end)/2; if(nums[mid] == target) { return mid; } else if (nums[mid] > target) { end = mid-1; } else { start = mid + 1; } } return -1; } }