Merge pull request 'feat: resolvido questao fibonacci' (#9) from feature/desafiodois into master

Reviewed-on: #9
This commit is contained in:
ThiagoDutraSampaioLeite 2022-10-30 15:30:04 +00:00
commit adc03fe263

View File

@ -1,4 +1,13 @@
export function fibonacci(value) {
// 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];
}