From dd9209f2d053d10535beab66691d4fcc6b125ac9 Mon Sep 17 00:00:00 2001 From: Sebastian Lindemeier Date: Tue, 1 Dec 2026 09:53:47 +0100 Subject: [PATCH] Refactor Day01 to use `CountBy` for ID counting --- AoC_2026/Day01.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AoC_2026/Day01.cs b/AoC_2026/Day01.cs index a4d3b09..9a48b67 100644 --- a/AoC_2026/Day01.cs +++ b/AoC_2026/Day01.cs @@ -17,8 +17,8 @@ public class Day01 : IPuzzleSolver { var input = ParsePuzzleInput(pathToPuzzleInput); var result = input - .GroupBy(id => id) - .OrderByDescending(g => g.Count()) + .CountBy(id => id) + .OrderByDescending(g => g.Value) .Take(3) .Aggregate(1L, (agg, next) => agg * next.Key); return result; @@ -28,8 +28,8 @@ public class Day01 : IPuzzleSolver { var input = ParsePuzzleInput(pathToPuzzleInput); var result = input - .GroupBy(id => id) - .OrderBy(g => g.Count()) + .CountBy(id => id) + .OrderBy(g => g.Value) .Take(3) .Aggregate(1L, (agg, next) => agg * next.Key); return result;