Refactor Day12 to simplify LINQ usage in GetMinTotalPresentArea by replacing .Select() with .Zip()
This commit is contained in:
1 parent
4a5eeb8cf0
commit
ed3b577516
1 file changed
+1
-1
+1
-1
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user