Skip to content

Instantly share code, notes, and snippets.

@Deraen
Last active August 29, 2015 14:05
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 Deraen/02a644e550673b76945d to your computer and use it in GitHub Desktop.
Save Deraen/02a644e550673b76945d to your computer and use it in GitHub Desktop.
(defn outrun-2 [pyramid]
(->> pyramid
(reduce
(fn [previous line]
(mapv (fn [this i]
(let [left (get previous (dec i) 0)
right (get previous i 0)]
(+ this (max left right))))
line
(range))))
(apply max)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment