aoc2022/6-a.hs

9 lines
219 B
Haskell

import Data.List
import Data.Maybe
markerLength = 4
main = interact $
show
. (+ 1)
. fromJust . (\l -> find (\i -> markerLength == length (nub $ map (l !!) [i - (markerLength - 1) .. i])) [(markerLength - 1)..])