diff --git a/3 Sum/JavaSolution3Sum.java b/3 Sum/JavaSolution3Sum.java new file mode 100644 index 0000000..6ee3cf1 --- /dev/null +++ b/3 Sum/JavaSolution3Sum.java @@ -0,0 +1,19 @@ +class Solution { + public List> threeSum(int[] nums) { + Set> res = new HashSet<>(); + if(nums.length==0) return new ArrayList<>(res); + Arrays.sort(nums); + for(int i=0; i0) k--; + else if (sum<0) j++; + } + + } + return new ArrayList<>(res); + } +}