diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2022-12-07 12:57:36 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2022-12-07 12:57:36 +0000 |
commit | d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56 (patch) | |
tree | 999464f801480565733c5223b020b2d762140b00 /6.py | |
download | aoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.tar.gz aoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.tar.xz aoc2022-d9a97e9bf28cf91f1a7e57f1298b7c742e25ed56.zip |
days 1-7
Diffstat (limited to '6.py')
-rw-r--r-- | 6.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -0,0 +1,8 @@ +with open('6.in') as f: + inp = f.read().rstrip() +def solve(inp, n): + for i in range(n, len(inp)): + if len(set(inp[i-n:i])) == n: + return i +print(solve(inp, 4)) +print(solve(inp, 14)) |