Skip to content

Instantly share code, notes, and snippets.

@dbyrne
dbyrne / gist:874621
Created March 17, 2011 16:27
Project Euler #18 & #67 - Haskell
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