From 1d2ca3033784f0906fcb6c14143d98fb69441b67 Mon Sep 17 00:00:00 2001 From: MarcelloMartins Date: Mon, 31 Oct 2022 18:41:43 -0300 Subject: [PATCH] fix(04-fibonacci): created parameter memo --- 04-fibonacci/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index e4dd408..2720a04 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,10 +1,9 @@ -export function fibonacci(value) { +export function fibonacci(value,memo = {}) { // implementar logica aqui if(value < 0) return 0; if(value < 2) return value; if(memo[value]) return memo[value]; let result = fibonacci(value - 1, memo) + fibonacci(value - 2, memo); memo[value] = result; - console.log(memo); return result; } \ No newline at end of file