mirror of
https://github.com/mx42/adventofcode.git
synced 2026-01-14 13:59:51 +01:00
Add 2015 day 10
This commit is contained in:
1
haskellAoC/inputs/2015/10
Normal file
1
haskellAoC/inputs/2015/10
Normal file
@@ -0,0 +1 @@
|
||||
1113222113
|
||||
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
|
||||
@@ -9,6 +9,7 @@ import Y2015.Day06
|
||||
import Y2015.Day07
|
||||
import Y2015.Day08
|
||||
import Y2015.Day09
|
||||
import Y2015.Day10
|
||||
|
||||
year2015 :: String -> [String] -> (String, String)
|
||||
year2015 "01" = y15day01
|
||||
@@ -20,3 +21,4 @@ year2015 "06" = y15day06
|
||||
year2015 "07" = y15day07
|
||||
year2015 "08" = y15day08
|
||||
year2015 "09" = y15day09
|
||||
year2015 "10" = y15day10
|
||||
|
||||
Reference in New Issue
Block a user