advent-of-code/2020/day6/day6.hs

10 lines
300 B
Haskell
Raw Normal View History

2020-12-06 07:38:48 +01:00
import AoC
import qualified Data.Set as S
import Data.Set (Set)
main = runAoC ((fmap . fmap) S.fromList . splitOnEmptyLines) part1 part2
where part1 = countSetsFolded S.union
part2 = countSetsFolded S.intersection
countSetsFolded f = sum . map (S.size . foldr1 f)