mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-13 08:01:03 +01:00
Merge pull request #166 from tachyons/patch-1
Fix the complexity memoization check
This commit is contained in:
commit
02db2b9550
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue