Add day 6 solution
This commit is contained in:
parent
f485dad5e9
commit
314b38e25c
1
06/example1
Normal file
1
06/example1
Normal file
@ -0,0 +1 @@
|
|||||||
|
mjqjpqmgbljsphdztnvjfqwrcgsmlb
|
1
06/example2
Normal file
1
06/example2
Normal file
@ -0,0 +1 @@
|
|||||||
|
bvwbjplbgvbhsrlpgdmjqwftvncz
|
1
06/example3
Normal file
1
06/example3
Normal file
@ -0,0 +1 @@
|
|||||||
|
nppdvjthqldpwncqszvftbrmjlhg
|
1
06/example4
Normal file
1
06/example4
Normal file
@ -0,0 +1 @@
|
|||||||
|
nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg
|
1
06/example5
Normal file
1
06/example5
Normal file
@ -0,0 +1 @@
|
|||||||
|
zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw
|
19
06/tuning.py
Normal file
19
06/tuning.py
Normal 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))
|
Loading…
Reference in New Issue
Block a user