Browse Source

Day 6

master
shu 9 months ago
parent
commit
4e87850e53
  1. 13
      2020/day06/day06.hs
  2. 2239
      2020/day06/input
  3. 15
      2020/day06/testinput

13
2020/day06/day06.hs

@ -0,0 +1,13 @@
import Data.List
import Data.List.Split
main :: IO ()
main = do
input <- splitOn "\n\n" <$> readFile "input"
print $ day6 input
day6 :: [String] -> (Int,Int)
day6 i = (c a i, c b i)
where a = nub . filter (/= '\n')
b = foldr1 intersect . lines
c p = sum . map (length . p)

2239
2020/day06/input

File diff suppressed because it is too large

15
2020/day06/testinput

@ -0,0 +1,15 @@
abc
a
b
c
ab
ac
a
a
a
a
b
Loading…
Cancel
Save