We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49700bf commit 6ec41ceCopy full SHA for 6ec41ce
puzzles/solutions/2022/d06/p2.py
@@ -5,7 +5,11 @@
5
6
7
def get_answer(input_text: str):
8
- raise NotImplementedError
+ """Return how many characters need to be processed before the first start-of-message marker is detected."""
9
+ for index in range(START_OF_MESSAGE_MINIMUM_UNIQUE_SEQUENCE_LENGTH - 1, len(input_text)):
10
+ sequence = input_text[index-START_OF_MESSAGE_MINIMUM_UNIQUE_SEQUENCE_LENGTH:index]
11
+ if len(set(sequence)) == START_OF_MESSAGE_MINIMUM_UNIQUE_SEQUENCE_LENGTH:
12
+ return index
13
14
15
if __name__ == "__main__":
0 commit comments