Skip to content

Instantly share code, notes, and snippets.

@l0gicpath
Last active August 29, 2015 13:55
Show Gist options
  • Save l0gicpath/8733723 to your computer and use it in GitHub Desktop.
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
(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]
@emad-elsaid
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment