Merge branch 'hotfix/Perfomace'

This commit is contained in:
Gustavo Rallenson Gonçalves Da Silva 2022-11-01 21:48:35 -03:00
commit c6e0b3b98b
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,10 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
if (value <= 1) { const fib = [0,1]
return value; let i = 1
while (value > fib.length-1){
fib.push(fib[i - 1] + fib[i])
i ++
} }
return fibonacci(value -1 ) + fibonacci(value -2) return fib[value]
} }

View File

@ -1,5 +1,6 @@
export function isPrime(value) { export function isPrime(value) {
// implementar logica aqui // implementar logica aqui
if(value === 1){ if(value === 1){
return false return false
}else{ }else{