Refactor Day12 to simplify LINQ usage in `GetMinTotalPresentArea` by replacing `.Select()` with `.Zip()`
This commit is contained in:
parent
4a5eeb8cf0
commit
ed3b577516
|
|
@ -33,7 +33,7 @@ public class Day12 : IPuzzleSolver<long>
|
||||||
private int GetMinTotalPresentArea(int[] presentCounts, int[] presentSizes)
|
private int GetMinTotalPresentArea(int[] presentCounts, int[] presentSizes)
|
||||||
{
|
{
|
||||||
return presentCounts
|
return presentCounts
|
||||||
.Select((presentCount, index) => presentCount * presentSizes[index])
|
.Zip(presentSizes, (count, size) => count * size)
|
||||||
.Sum();
|
.Sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue