feat: resolve funcão fibonacci

This commit is contained in:
José Gregorio Mata Rodríguez 2022-10-29 00:46:08 -02:00
parent 1f1e05e78d
commit 33405f4457

View File

@ -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];
}