DEV Community

Discussion on: Advent of Code 2020: Python Solution Day 6

Collapse
 
oguimbal profile image
Olivier Guimbal

My haskell solution

groups = splitWhen (== "") . lines <$> readFile "./data.txt"
part1 = sum . map (length . Set.fromList . intercalate "") <$> groups
part2 = sum . map (Set.size . foldl1 Set.intersection . map Set.fromList)  <$> groups
Enter fullscreen mode Exit fullscreen mode
Collapse
 
qviper profile image
Viper

Just in 3 lines. It is great.