aoc2022/6-a.hs

9 lines
219 B
Haskell
Raw 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
markerLength = 4
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)..])