Update dynamic_programming/fast_fibonacci.rb

Co-authored-by: vzvu3k6k <vzvu3k6k@gmail.com>
This commit is contained in:
Vitor Oliveira 2021-03-07 12:15:05 -08:00 committed by GitHub
parent 3d8bc6b2c1
commit b1f6170d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,5 +4,5 @@ def fast_fibonacci(number, memo_hash = {})
if number == 0 || number == 1
return number
end
memo_hash[number] ||= fibonacci(number - 1, memo_hash) + fibonacci(number -2, memo_hash)
end
memo_hash[number] ||= fibonacci(number - 1, memo_hash) + fibonacci(number - 2, memo_hash)
end