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:
commit
48e57959c3
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user