From 882a6b02d64b37184d60b7d5d6235d77e1943276 Mon Sep 17 00:00:00 2001 From: carloswinter Date: Fri, 28 Oct 2022 15:58:51 -0300 Subject: [PATCH] feat(fibonacci): adiciona resolucao questao04-fibonacci --- 04-fibonacci/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..f3dd52e 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,8 @@ export function fibonacci(value) { // implementar logica aqui - + const arr = [0, 1]; + for (let i = 2; i <= value; i++) { + arr[i] = arr[i - 2] + arr[i - 1]; + } + return arr[value]; } \ No newline at end of file