rj1
about | log | files | refs
commit d7a902850fb5507e6a2221862a2854a8acdaa63d
parent 8f5d4ba650fb8a6faafd0e2325cdb39bc7fe6d55
author: rj1 <[email protected]>
date:   Mon,  5 Dec 2022 23:39:02 -0600

day 6 solution

Diffstat:
A2022/06/solution.py | 13+++++++++++++
MREADME.md | 2++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/2022/06/solution.py b/2022/06/solution.py @@ -0,0 +1,13 @@ +import os + +base_dir = os.path.realpath(os.path.dirname(__file__)) +with open(base_dir + "/input.txt", "r") as file: + input = file.read().rstrip() + +for i in range(1, len(input)): + # c = 4 # part 1 + c = 14 # part 2 + u = set(input[i - (c - 1) : i + 1]) + if len(u) == c: + print(i + 1) + break diff --git a/README.md b/README.md @@ -12,6 +12,7 @@ this repo contains my solutions for advent of code |3|00:04:22|368|0| |4|00:02:17|118|0| |5|00:17:50|2168|0| +|6|00:08:15|4815|0| ### part 2 @@ -22,6 +23,7 @@ this repo contains my solutions for advent of code |3|00:08:06|442|0| |4|00:05:06|443|0| |5|12:38:15|61014|0| +|6|00:08:47|3739|0| ## notes