forked from M3-Academy/challenge-algorithms-v2.0
fix(04-fibonacci)otimiza codigo fibonacci
This commit is contained in:
parent
5d287b0079
commit
7d3bd1a66c
@ -1,11 +1,8 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
if (value === 0){
|
||||
return value
|
||||
}else if (value === 1) {
|
||||
if (value === 0 || value === 1){
|
||||
return value
|
||||
}else{
|
||||
return fibonacci(value - 1) + fibonacci(value - 2)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user