From aefde347d333eb5e20336ff98d8353a4b30154bd Mon Sep 17 00:00:00 2001 From: Puneet Gaddi Date: Tue, 26 Mar 2024 14:32:01 +0530 Subject: [PATCH] =?UTF-8?q?Update=20=E2=9C=85=20=20Pattern=2002:=20Two=20P?= =?UTF-8?q?ointers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The end variable was pointed by the i in for loop. --- "\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..8cbca91 100644 --- "a/\342\234\205 Pattern 02: Two Pointers.md" +++ "b/\342\234\205 Pattern 02: Two Pointers.md" @@ -417,7 +417,7 @@ function searchPair(arr, targetSum, first, triplets){ //since arr[end] >= arr[start], therefore, we can replace arr[end] //by any number between start and end to get a sum less than the targetSum for(let i = end; i > start; i--){ - triplets.push(arr[first], arr[start], arr[end]) + triplets.push(arr[first], arr[start], arr[i]) } start++ } else {