From ecbbd39af1d59de2bc99ad143d96a76edc22f635 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Wed, 3 Dec 2025 05:55:47 +0000 Subject: [PATCH] day 3 simplify --- day03/sol.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/day03/sol.py b/day03/sol.py index de417a2..40e5219 100644 --- a/day03/sol.py +++ b/day03/sol.py @@ -1,25 +1,6 @@ input = open("input") -t = 0 -for line in input: - cells = list(line.strip()) - cells.reverse() - b = cells[0] - max = 0 - for c in cells[1:]: - j = int(c+b) - if j > max: - max = j - if c > b: - b = c - #print(max) - t += max -print(t) - - -# Part 2 - -input = open("input") -t = 0 +part1 = 0 +part2 = 0 for line in input: cells = list(line.strip()) cells.reverse() @@ -29,6 +10,8 @@ for line in input: j = c+max[i-1] if j > max[i]: max[i] = j - print(max[12]) - t += int(max[12]) -print(t) + #print(max[12]) + part1 += int(max[2]) + part2 += int(max[12]) +print(part1) +print(part2)