criando o codigo do e o calculo fibonacci que deve retornar

This commit is contained in:
PATRICK DE SOUZA SILVA 2022-10-28 17:50:57 -03:00
parent c6f6df9c59
commit 8ff61e6ac0

View File

@ -1,4 +1,9 @@
export function fibonacci(value) {
export function fibonacci(value, memo) {
// implementar logica aqui
}
memo = memo || {}
if (memo[value]) return memo[value]
if (value <= 1) return value
return (memo[value] = fibonacci(value - 1, memo) + fibonacci(value - 2, memo))
}