Add all the A tasks
This commit is contained in:
parent
2dd7375f96
commit
051504d65b
1608 changed files with 18584 additions and 0 deletions
4
Task/Anonymous-recursion/Ruby/anonymous-recursion-3.rb
Normal file
4
Task/Anonymous-recursion/Ruby/anonymous-recursion-3.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def fib(n)
|
||||
raise RangeError, "fib of negative" if n < 0
|
||||
(fib2 = proc { |n| n < 2 ? n : fib2[n - 1] + fib2[n - 2] })[n]
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue