Created
December 6, 2022 06:18
-
-
Save dartharva/34a04f0513911aabb40891412d42c9c9 to your computer and use it in GitHub Desktop.
Advent of Code 2022, Day 3 - Simple, verbose python
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
with open('input.txt', 'r') as input_file: | |
input_signal = input_file.read().strip() | |
def signalcatch(distinct_chars): | |
for i in range(len(input_signal)): | |
buf_stream = input_signal[i:i+distinct_chars] | |
if len(set(buf_stream)) == len(buf_stream): | |
return i + distinct_chars | |
print(signalcatch(4), signalcatch(14)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment