feat(fibonacci): Implementa função fibonacci
This commit is contained in:
parent
d377a0c420
commit
cfe0e803bf
@ -1,4 +1,13 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
|
||||
let first = 0;
|
||||
let second = 1;
|
||||
if (value <= 1) {
|
||||
return value;
|
||||
}
|
||||
for(let i = 3; i <= value; i++){
|
||||
second = first + second;
|
||||
first = second - first;
|
||||
}
|
||||
return first + second;
|
||||
}
|
Loading…
Reference in New Issue
Block a user