From a59f60048ccf3f29aeccc8deff016acf8fdd300c Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 6 Dec 2022 06:13:04 +0100 Subject: lol --- 2022/06/solve.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2022/06/solve.py (limited to '2022/06/solve.py') 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()}") -- cgit v1.2.3