Solve day3

This commit is contained in:
2025-12-05 14:34:16 -08:00
parent 1a7840ab37
commit 953d4e4df8
4 changed files with 233 additions and 0 deletions

13
day3/part1.py Normal file
View File

@@ -0,0 +1,13 @@
FILE = "input.txt"
def main():
return sum(max_for_line(line.strip()) for line in open(FILE))
def max_for_line(line: str) -> int:
tens = max(int(n) for n in line[:-1])
idx = line.index(str(tens))
ones = max(int(n) for n in line[idx+1:])
return tens * 10 + ones
if __name__ == "__main__":
print(main())