Skip to content

Instantly share code, notes, and snippets.

@dartharva
Created December 6, 2022 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dartharva/34a04f0513911aabb40891412d42c9c9 to your computer and use it in GitHub Desktop.
Save dartharva/34a04f0513911aabb40891412d42c9c9 to your computer and use it in GitHub Desktop.
Advent of Code 2022, Day 3 - Simple, verbose python
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