From 33405f4457d50f09f96ee0432c506c4b9bd26ec8 Mon Sep 17 00:00:00 2001 From: JoseGregorioMataRodriguez Date: Sat, 29 Oct 2022 00:46:08 -0200 Subject: [PATCH] =?UTF-8?q?feat:=20resolve=20func=C3=A3o=20fibonacci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..413eee1 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,13 @@ export function fibonacci(value) { // implementar logica aqui + let fibo = []; + let i = 0; + for (i = 0 ; i <= value; i++) { + if (i < 2) + fibo[i] = i; + else + fibo[i] = fibo[i-1] + fibo[i-2]; + } + return fibo[value]; } \ No newline at end of file