feat: resolvido questao fibonacci

This commit is contained in:
ThiagoDuutra 2022-10-30 12:29:26 -03:00
parent 11de2525a5
commit 76dc0a1a24

View File

@ -1,4 +1,13 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
if (value <= 1) {
} return value;
}
const result = [0, 1];
for (let i = 2; i <= value; i++) {
result[i] = result[i - 1] + result[i - 2];
}
return result[result.length - 1];
}