From fcaa4dc2ef70c5bff0070b5e3fb92a86d4a7a611 Mon Sep 17 00:00:00 2001 From: Amatsugu Date: Tue, 3 Dec 2024 18:59:52 -0500 Subject: [PATCH] misc --- AdventOfCode/Problems/AOC2024/Day3/MullItOver.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AdventOfCode/Problems/AOC2024/Day3/MullItOver.cs b/AdventOfCode/Problems/AOC2024/Day3/MullItOver.cs index 561ce28..80ea1c4 100644 --- a/AdventOfCode/Problems/AOC2024/Day3/MullItOver.cs +++ b/AdventOfCode/Problems/AOC2024/Day3/MullItOver.cs @@ -16,7 +16,7 @@ internal partial class MullItOver : Problem public override void CalculatePart1() { var matches = Mul().Matches(_data); - Part1 = matches.Select(m => (int.Parse(m.Groups["a"].Value), int.Parse(m.Groups["b"].Value))).Select(v => v.Item1 * v.Item2).Sum(); + Part1 = matches.Select(m => (int.Parse(m.Groups["a"].ValueSpan), int.Parse(m.Groups["b"].ValueSpan))).Select(v => v.Item1 * v.Item2).Sum(); } public override void CalculatePart2() @@ -25,7 +25,7 @@ internal partial class MullItOver : Problem var muls = DosAndDonts().Matches(_data); foreach (Match match in muls) { - switch (match.Value) + switch (match.ValueSpan) { case ['d', 'o', 'n', ..]: doing = false; @@ -36,7 +36,7 @@ internal partial class MullItOver : Problem default: if (!doing) continue; - Part2 += int.Parse(match.Groups["a"].Value) * int.Parse(match.Groups["b"].Value); + Part2 += int.Parse(match.Groups["a"].ValueSpan) * int.Parse(match.Groups["b"].ValueSpan); break; } }