diff --git a/dynamic_programming/fibonacci.rb b/dynamic_programming/fibonacci.rb index a7aa6e9..617a083 100644 --- a/dynamic_programming/fibonacci.rb +++ b/dynamic_programming/fibonacci.rb @@ -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)