feat: resolucao funcao fibonacci

This commit is contained in:
Guilherme de Camargo Barbosa 2022-10-29 16:48:49 -03:00
parent 67faa57ff2
commit 81678ac150

View File

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