feat: solucao fibonacci

This commit is contained in:
Rafael Sampaio de Oliveira 2022-10-28 08:40:42 -03:00
parent c6f6df9c59
commit a0f907d08f

View File

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