2022-10-27 15:07:13 +00:00
|
|
|
export function fibonacci(value) {
|
|
|
|
// implementar logica aqui
|
2022-10-29 19:48:49 +00:00
|
|
|
|
|
|
|
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
|