fix(04-fibonacci)otimiza codigo fibonacci

This commit is contained in:
Henrique Martins Silva 2022-10-29 07:20:29 -03:00
parent 5d287b0079
commit 7d3bd1a66c

View File

@ -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)
}
}
}