Last active
August 29, 2015 14:05
-
-
Save Deraen/02a644e550673b76945d to your computer and use it in GitHub Desktop.
This file contains 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
(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