Refactor Day12 to remove redundant Where in presentSizes calculation and adjust method modifier for GetMinTotalPresentArea
This commit is contained in:
+1
-2
@@ -16,7 +16,6 @@ public class Day12 : IPuzzleSolver<long>
|
||||
.Split($"{Environment.NewLine}{Environment.NewLine}", StringSplitOptions.TrimEntries)
|
||||
.ToList();
|
||||
var presentSizes = puzzleInput[..^1]
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||
.Select(s => s.Count(c => c == '#'))
|
||||
.ToArray();
|
||||
var regions = puzzleInput[^1]
|
||||
@@ -37,7 +36,7 @@ public class Day12 : IPuzzleSolver<long>
|
||||
return everythingFits;
|
||||
}
|
||||
|
||||
private static int GetMinTotalPresentArea(int[] presentCounts, int[] presentSizes)
|
||||
private int GetMinTotalPresentArea(int[] presentCounts, int[] presentSizes)
|
||||
{
|
||||
return presentCounts
|
||||
.Select((presentCount, index) => presentCount * presentSizes[index])
|
||||
|
||||
Reference in New Issue
Block a user