From 3667f5adc2c05c352ae21660dee68797eb39180c Mon Sep 17 00:00:00 2001 From: Nazy Date: Thu, 15 Feb 2018 17:36:08 -0500 Subject: [PATCH] Update js2.html I think the implementation for Memoization of Fibonacci is not correct. You are not assigning the value for non-existing memo. --- js2.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js2.html b/js2.html index 4c2a2b1..6bc3bc9 100644 --- a/js2.html +++ b/js2.html @@ -592,7 +592,7 @@

17. memoization

else if (n < 2){ return 1; }else{ - _fibonacci(n-2) + _fibonacci(n-1); + return memo[n] = _fibonacci(n-2) + _fibonacci(n-1); } }