mirror of
https://github.com/mx42/adventofcode.git
synced 2026-01-14 22:09:50 +01:00
Add 2015 day 10
This commit is contained in:
14
haskellAoC/src/Y2015/Day10.hs
Normal file
14
haskellAoC/src/Y2015/Day10.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
module Y2015.Day10 (y15day10) where
|
||||
|
||||
import Data.List
|
||||
|
||||
lookAndSay :: String -> String
|
||||
lookAndSay input = concat $ map describe_group $ group input
|
||||
where describe_group g = (show $ length g) ++ (head g):""
|
||||
|
||||
|
||||
y15day10 :: [String] -> (String, String)
|
||||
y15day10 (input:_) = (part1, part2)
|
||||
where part1 = show $ length $ part1resp
|
||||
part2 = show $ length $ head $ drop 10 $ iterate lookAndSay part1resp
|
||||
part1resp = head $ drop 40 $ iterate lookAndSay input
|
||||
Reference in New Issue
Block a user