AoC/2022/day06/day06.hs
2022-12-06 10:30:31 +01:00

12 lines
244 B
Haskell

import Data.List.Split
import Data.List
main :: IO ()
main = do
input <- readFile "input"
print $ day6 4 input
print $ day6 14 input
day6 :: Int -> String -> Int
day6 n = (+n) . head . elemIndices n . map (length.nub.sort) . divvy n 1