Merge pull request 'criando o codigo do e o calculo fibonacci que deve retornar' (#1) from feature/fibonacci into develop

Reviewed-on: #1
This commit is contained in:
PATRICK DE SOUZA SILVA 2022-11-02 16:19:49 +00:00
commit 48e57959c3

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