mirror of
https://github.com/Crocmagnon/advent-of-code.git
synced 2024-11-24 23:48:13 +01:00
Solve day6 part 2
This commit is contained in:
parent
ffdc98b7b9
commit
e1b1a11dae
1 changed files with 6 additions and 2 deletions
|
@ -46,9 +46,13 @@ def sliding_window(stream: str, size: int) -> Generator[str]:
|
|||
|
||||
|
||||
def solve_part_2(data: DataType) -> int:
|
||||
size = 14
|
||||
for index, window in enumerate(sliding_window(data, size)):
|
||||
if not repeating(window):
|
||||
return index + size
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main("inputs/day06-test1", expected_part_1=10)
|
||||
main("inputs/day06", expected_part_1=1578)
|
||||
main("inputs/day06-test1", expected_part_1=10, expected_part_2=29)
|
||||
main("inputs/day06", expected_part_1=1578, expected_part_2=2178)
|
||||
|
|
Loading…
Reference in a new issue