Last active
December 12, 2022 13:39
-
-
Save rtt/ba82379810bb21d3dbcaee77798a0011 to your computer and use it in GitHub Desktop.
This file contains 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
def partN(input_data, step): | |
for i, window in enumerate( | |
[input_data[i:i + step] for i in range(len(input_data) - step)]): | |
if len(set(window)) == step: | |
return i + step | |
if __name__ == '__main__': | |
with open('./input.txt') as f: | |
inp = f.read().strip() | |
print(partN(inp, 4)) | |
print(partN(inp, 14)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment