From 30c4ef5fcd095463982b4e79a1d7122d4d1c870f Mon Sep 17 00:00:00 2001 From: Starnakin Date: Mon, 8 Dec 2025 13:24:50 +0100 Subject: [PATCH] add: day07: part1 --- 2025/day07/part1.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 2025/day07/part1.py diff --git a/2025/day07/part1.py b/2025/day07/part1.py new file mode 100644 index 0000000..88c9257 --- /dev/null +++ b/2025/day07/part1.py @@ -0,0 +1,27 @@ +text: str + +with open("input.txt") as f: + text = f.read() + +total: int = 0 + +lines = [[c for c in line] for line in text.splitlines()] + +roots: set[int] = set() +roots.add(len(lines[0]) // 2) + +for i, line in enumerate(lines): + for j, c in enumerate(line): + if (c == '^' and j in roots): + roots.remove(j) + roots.add(j - 1) + roots.add(j + 1) + total += 1 +# debug print() + for root in roots: + line[root] = "|" + +for line in lines: + print("".join(line)) + +print(total) \ No newline at end of file