From edb453f315e2a2d81d945b48267c62f17b20998e Mon Sep 17 00:00:00 2001 From: Adarsh Gupta <73733229+adarsh-gupta101@users.noreply.github.com> Date: Sat, 29 Jul 2023 22:16:50 +0530 Subject: [PATCH] =?UTF-8?q?Update=20=E2=9C=85=20=20Pattern=2001=20:=20Slid?= =?UTF-8?q?ing=20Window.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was mistake in the loop condition, the loop was running infinitely! --- "\342\234\205 Pattern 01 : Sliding Window.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\342\234\205 Pattern 01 : Sliding Window.md" "b/\342\234\205 Pattern 01 : Sliding Window.md" index fa3083a..4ca4603 100644 --- "a/\342\234\205 Pattern 01 : Sliding Window.md" +++ "b/\342\234\205 Pattern 01 : Sliding Window.md" @@ -333,7 +333,7 @@ function fruitsInBaskets(fruits) { let fruitFrequency = {}; //try to extend the range - for(let windowEnd = 0; windowEnd < fruits.length; window++) { + for(let windowEnd = 0; windowEnd < fruits.length; windowEnd++) { const endFruit = fruits[windowEnd] if(!(endFruit in fruitFrequency)) { fruitFrequency[endFruit] = 0