advent-of-code/src/holt59/aoc/2022/day1.py
2024-12-08 13:55:25 +01:00

13 lines
310 B
Python

from typing import Any, Iterator
from ..base import BaseSolver
class Solver(BaseSolver):
def solve(self, input: str) -> Iterator[Any]:
blocks = input.split("\n\n")
values = sorted(sum(map(int, block.split())) for block in blocks)
yield values[-1]
yield sum(values[-3:])