Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created May 16, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/13f6e4a1e812b2f15ec79cf49fadb210 to your computer and use it in GitHub Desktop.
Save chuck0523/13f6e4a1e812b2f15ec79cf49fadb210 to your computer and use it in GitHub Desktop.
(3..gets.to_i - 1).to_a.inject([0, 0, 1]) {|tri, a| tri << tri[tri.size - 1] + tri[tri.size - 2] + tri[tri.size - 3]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment