Created
December 7, 2022 01:20
-
-
Save evinism/423feca631aacbad7414cda83d0b9fbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
window :: Int | |
window = 14 | |
main = do | |
input <- readFile "input.txt" | |
print $ solve window input | |
noDupes :: Eq a => [a] -> Bool | |
noDupes x = nub x == x | |
solve :: Int -> String -> Int | |
solve depth str = if noDupes (take window str) | |
then depth | |
else solve (depth + 1) $ tail str | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment