aoc2022/6-b.hs

10 lines
264 B
Haskell

import Data.List
import Data.Maybe
-- literally only changes this one constant
markerLength = 14
main = interact $
show
. (+ 1)
. fromJust . (\l -> find (\i -> markerLength == length (nub $ map (l !!) [i - (markerLength - 1) .. i])) [(markerLength - 1)..])