From 5d9a2cb81663a565340d122799de53306b7b60ba Mon Sep 17 00:00:00 2001 From: Nikhil Patel <40319586+NikhilP99@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:41:03 +0530 Subject: [PATCH] Fixing Quadruple Sum to Target solution The end pointer is compared incorrectly while avoiding duplicates. --- "\342\234\205 Pattern 02: Two Pointers.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\342\234\205 Pattern 02: Two Pointers.md" "b/\342\234\205 Pattern 02: Two Pointers.md" index e77d013..d4dc0f0 100644 --- "a/\342\234\205 Pattern 02: Two Pointers.md" +++ "b/\342\234\205 Pattern 02: Two Pointers.md" @@ -569,7 +569,7 @@ function searchPairs(arr, targetSum, first, second, quads) { //skip the same element to avoid duplicate quadruplets start++ } - while(start < end && arr[end] === arr[end -1]){ + while(start < end && arr[end] === arr[end +1]){ //skip the same element to avoid duplicate quadruplets end-- }