This commit is contained in:
2025-12-06 21:29:45 -05:00
parent 55a8ea0281
commit 5f45853889

View File

@@ -28,12 +28,12 @@ public partial class TrashCompactor : Problem<long, long>
public override void CalculatePart2() public override void CalculatePart2()
{ {
foreach (var item in _part2Data) foreach (var (op, values) in _part2Data)
{ {
Part2 += item.op switch Part2 += op switch
{ {
'+' => item.values.Aggregate((a, b) => a + b), '+' => values.Aggregate((a, b) => a + b),
'*' => item.values.Aggregate((a, b) => a * b), '*' => values.Aggregate((a, b) => a * b),
_ => throw new InvalidOperationException() _ => throw new InvalidOperationException()
}; };
} }