From b79c0197d3d177b4f080a56685ccb150cb19c363 Mon Sep 17 00:00:00 2001 From: Hritwika Sarkar <72162152+Hrit20@users.noreply.github.com> Date: Fri, 29 Oct 2021 23:32:52 +0530 Subject: [PATCH 1/2] 3Sum Java problem --- 3 Sum/3Sum.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 3 Sum/3Sum.java diff --git a/3 Sum/3Sum.java b/3 Sum/3Sum.java new file mode 100644 index 0000000..c7d88a5 --- /dev/null +++ b/3 Sum/3Sum.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); + } +} \ No newline at end of file From f93b7279ca27c4a4354014a2575c4907d860888c Mon Sep 17 00:00:00 2001 From: Hritwika Sarkar <72162152+Hrit20@users.noreply.github.com> Date: Sun, 31 Oct 2021 00:21:32 +0530 Subject: [PATCH 2/2] JavaSolution3Sum.java --- 3 Sum/{3Sum.java => JavaSolution3Sum.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename 3 Sum/{3Sum.java => JavaSolution3Sum.java} (96%) diff --git a/3 Sum/3Sum.java b/3 Sum/JavaSolution3Sum.java similarity index 96% rename from 3 Sum/3Sum.java rename to 3 Sum/JavaSolution3Sum.java index c7d88a5..6ee3cf1 100644 --- a/3 Sum/3Sum.java +++ b/3 Sum/JavaSolution3Sum.java @@ -16,4 +16,4 @@ public List> threeSum(int[] nums) { } return new ArrayList<>(res); } -} \ No newline at end of file +}