aboutsummaryrefslogtreecommitdiff
path: root/2022/06/solve.py
diff options
context:
space:
mode:
authorMarvin Borner2022-12-06 06:13:04 +0100
committerMarvin Borner2022-12-06 06:13:04 +0100
commita59f60048ccf3f29aeccc8deff016acf8fdd300c (patch)
tree5493d41bc7109472c43d0a49427a7075a4f9f711 /2022/06/solve.py
parenta36c6fe4b3fe93c936d40dcca41f5e8cbf4987d7 (diff)
lol
Diffstat (limited to '2022/06/solve.py')
-rw-r--r--2022/06/solve.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/2022/06/solve.py b/2022/06/solve.py
new file mode 100644
index 0000000..5de1270
--- /dev/null
+++ b/2022/06/solve.py
@@ -0,0 +1,14 @@
+data = [dat for dat in open("input").readlines() if dat != ''][0]
+
+def part1():
+ for i in range(4, len(data)):
+ if len(data[i-4:i]) == len(set(data[i-4:i])):
+ return i
+
+def part2():
+ for i in range(14, len(data)):
+ if len(data[i-14:i]) == len(set(data[i-14:i])):
+ return i
+
+print(f"Part 1: {part1()}")
+print(f"Part 2: {part2()}")