mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-25 21:58:57 +01:00
Update dynamic_programming/fast_fibonacci.rb
Co-authored-by: vzvu3k6k <vzvu3k6k@gmail.com>
This commit is contained in:
parent
3d8bc6b2c1
commit
b1f6170d02
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue