forked from M3-Academy/challenge-algorithms-v2.0
feat: resolve funcão fibonacci
This commit is contained in:
parent
1f1e05e78d
commit
33405f4457
@ -1,4 +1,13 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
let fibo = [];
|
||||
let i = 0;
|
||||
for (i = 0 ; i <= value; i++) {
|
||||
if (i < 2)
|
||||
fibo[i] = i;
|
||||
else
|
||||
fibo[i] = fibo[i-1] + fibo[i-2];
|
||||
}
|
||||
return fibo[value];
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user