Created
March 17, 2011 16:27
-
-
Save dbyrne/874621 to your computer and use it in GitHub Desktop.
Project Euler #18 & #67 - Haskell
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
maxPath (x:y:xs) = maxPath (z:xs) | |
where z = zipWith (+) (zipWith max x (tail x)) y | |
maxPath [[x]] = x | |
convert = map (map read . words) | |
prob67 = show . maxPath . reverse . convert . lines | |
main = readFile "triangle.txt" >>= putStrLn . prob67 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment