diff --git a/Advent2023/Day11.cs b/Advent2023/Day11.cs index 9286035..9641004 100644 --- a/Advent2023/Day11.cs +++ b/Advent2023/Day11.cs @@ -18,8 +18,8 @@ public class Day11 public void Solve(string filename, int expansionFactor, long expectedAnswer) { var grid = FileIterator.LoadGrid(filename); - var maxX = 0; - var maxY = 0; + var maxX = grid.GetLength(0) - 1; + var maxY = grid.GetLength(1) - 1; Dictionary> galByRow = []; Dictionary> galByCol = []; @@ -28,9 +28,6 @@ public void Solve(string filename, int expansionFactor, long expectedAnswer) { if (grid[x, y] == '.') continue; - maxX = Math.Max(maxX, x); - maxY = Math.Max(maxY, y); - var gal = new XY(x, y); galByRow.GetOrCreate(y, () => []).Add(gal); galByCol.GetOrCreate(x, () => []).Add(gal);