Merge pull request #166 from tachyons/patch-1

Fix the complexity memoization check
This commit is contained in:
Vitor Oliveira 2021-08-22 14:27:48 -07:00 committed by GitHub
commit 02db2b9550
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,7 @@ def fibonacci(number, memo_hash = {})
end
def memoize(number, memo_hash)
return memo_hash[number] if memo_hash.keys.include? number
return memo_hash[number] if memo_hash.key? number
memo_hash[number] = memoize(number - 1, memo_hash) + memoize(number - 2, memo_hash)