Skip to content

Instantly share code, notes, and snippets.

@evinism
Created December 7, 2022 01:20
Show Gist options
  • Save evinism/423feca631aacbad7414cda83d0b9fbc to your computer and use it in GitHub Desktop.
Save evinism/423feca631aacbad7414cda83d0b9fbc to your computer and use it in GitHub Desktop.
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