Last active
August 29, 2015 13:55
-
-
Save l0gicpath/8733723 to your computer and use it in GitHub Desktop.
One liner ruby solution for project euler problem #2 because ruby is hardcore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(l ,ss = 4000000, proc {|p, n, s| p >= l || n >= l ? s : n.even?? ss[n, n + p, s + n] : ss[n, n + p, s] })[1][1, 2, 0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for the explanation, i think the proc part and the multi assignment will help me alot with my scripts,
these are so little bits i miss while learning the language.