Solve hanging lantern problem: Difference between revisions
m
→Directly computing the count
(→{{header|Ruby}}: Add Ruby) |
|||
Line 1,393:
===Directly computing the count===
<syntaxhighlight lang="ruby" line>Factorial = Hash.new{|h, k| h[k] = k * h[k-1] } # a memoized factorial
Factorial[0] = 1
|