aboutsummaryrefslogtreecommitdiff
path: root/2022/06/solve.py
diff options
context:
space:
mode:
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()}")