Skip to content

Commit

Permalink
Small refactor to day 11
Browse files Browse the repository at this point in the history
  • Loading branch information
elpollouk committed Dec 11, 2023
1 parent 0cd9f5a commit 97878f3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Advent2023/Day11.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, List<XY>> galByRow = [];
Dictionary<int, List<XY>> galByCol = [];
Expand All @@ -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);
Expand Down

0 comments on commit 97878f3

Please sign in to comment.