← All problemsSign in

3218. Minimum Cost for Cutting Cake I

LeetCodeArrayTwo PointersDynamic ProgrammingGreedySortingOpen on judge ↗

There is an m x n cake that needs to be cut into 1 x 1 pieces. You are given integers m, n, and two arrays: - horizontalCut of size m - 1, where horizontalCut[i] represents the cost to cut along the horizontal line i. - verticalCut of size n - 1, where verticalCut[j] represents the cost to cut along the vertical line j. In one operation, you can choose any piece of cake that is not yet a 1 x 1

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start