Add day 6 solution

This commit is contained in:
Michal Kunc 2022-12-06 09:53:42 +01:00
parent f485dad5e9
commit 314b38e25c
6 changed files with 24 additions and 0 deletions

1
06/example1 Normal file
View File

@ -0,0 +1 @@
mjqjpqmgbljsphdztnvjfqwrcgsmlb

1
06/example2 Normal file
View File

@ -0,0 +1 @@
bvwbjplbgvbhsrlpgdmjqwftvncz

1
06/example3 Normal file
View File

@ -0,0 +1 @@
nppdvjthqldpwncqszvftbrmjlhg

1
06/example4 Normal file
View File

@ -0,0 +1 @@
nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg

1
06/example5 Normal file
View File

@ -0,0 +1 @@
zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw

19
06/tuning.py Normal file
View File

@ -0,0 +1,19 @@
import fileinput
from typing import Iterable
def solve(data: str) -> int:
for idx in range(len(data)):
if len(set(list(data[idx:idx+4]))) == 4:
return idx + 4
def solveb(data: str) -> int:
for idx in range(len(data)):
if len(set(list(data[idx:idx+14]))) == 14:
return idx + 14
if __name__ == "__main__":
with fileinput.input() as f:
data = f.readline()
print(solve(data))
print(solveb(data))