10 lines
244 B
JavaScript
10 lines
244 B
JavaScript
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))
|
|
}
|