Refactor Day12 to remove redundant `Where` in presentSizes calculation and adjust method modifier for `GetMinTotalPresentArea`
This commit is contained in:
parent
cf4c79c4c1
commit
ab7af90af9
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Reference in New Issue