You are given two integers m and n representing a cake of size m n, along with two integer arrays:
horizontalCut of length m horizontalCut[i] represents the cost to perform a horizontal cut along line i.
verticalCut of length n verticalCut[j] represents the cost to perform a vertical cut along line j.
In one operation, you can choose any existing piece of cake and cut it along a horizontal or vertical line:
Cutting along horizontal line i incurs a cost of horizontalCut[i].
Cutting along vertical line j incurs a cost of verticalCut[j].
Each cut divides a single piece into two smaller pieces. To fully separate multiple pieces along the same line, the cut must be performed individually on each piece, incurring the corresponding cost each time.
Return the minimum total cost required to cut the cake into m n individual pieces of size
Constraints:
m, n
horizontalCut.length m
verticalCut.length n
horizontalCut[i], verticalCut[i]
You are given two integers m and n representing a cake of size m n, along with two integer arrays:
horizontalCut of length m horizontalCut[i] represents the cost to perform a horizontal cut along line i.
verticalCut of length n verticalCut[j] represents the cost to perform a vertical cut along line j.
In one operation, you can choose any existing piece of cake and cut it along a horizontal or vertical line:
Cutting along horizontal line i incurs a cost of horizontalCut[i].
Cutting along vertical line j incurs a cost of verticalCut[j].
Each cut divides a single piece into two smaller pieces. To fully separate multiple pieces along the same line, the cut must be performed individually on each piece, incurring the corresponding cost each time.
Return the minimum total cost required to cut the cake into m n individual pieces of size
Constraints:
m, n
horizontalCut.length m
verticalCut.length n
horizontalCut[i], verticalCut[i]