Practice Minimum Cost for Cutting Cake II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
An m by n cake must be divided into unit squares. horizontalCut[i] gives the fixed cost of cutting along horizontal grid line i, and verticalCut[j] gives the fixed cost for vertical grid line j. One operation cuts a single existing piece along one of those lines into two pieces and pays that line’s cost. Reusing a line on another piece incurs its cost again. Return the minimum total cost to produce all 1 by 1 pieces.
Source: Minimum Cost for Cutting Cake II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
m = 3, n = 2, horizontalCut = [1,3], verticalCut = [5]
13
# Example 2
m = 2, n = 2, horizontalCut = [7], verticalCut = [4]
15
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Cost for Cutting Cake II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.