Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Created March 23, 2015 15:02
Show Gist options
  • Save jooyunghan/c5479440a567271cfe1d to your computer and use it in GitHub Desktop.
Save jooyunghan/c5479440a567271cfe1d to your computer and use it in GitHub Desktop.
-- euler67
-- input file: https://projecteuler.net/project/resources/p067_triangle.txt
readInput = map (map read . words) . lines
solve = foldr1 merge
where merge xs ys = zipWith (+) xs $ zipWith max ys (tail ys)
main = do
content <- readFile "p067_triangle.txt"
--content <- return "3\n7 4\n2 4 6\n8 5 9 3"
putStrLn $ show $ solve $ readInput content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment