aoc2022/6-b.hs

10 lines
264 B
Haskell
Raw Permalink Normal View History

2022-12-06 07:57:31 +01:00
import Data.List
2022-12-06 08:26:56 +01:00
import Data.Maybe
2022-12-06 07:57:31 +01:00
-- literally only changes this one constant
markerLength = 14
main = interact $
show
2022-12-06 08:26:56 +01:00
. (+ 1)
. fromJust . (\l -> find (\i -> markerLength == length (nub $ map (l !!) [i - (markerLength - 1) .. i])) [(markerLength - 1)..])