#3218

Minimum Cost for Cutting Cake I

specialist · 740 · lc medium +31 · 58.5% accepted · 205 likes · top 55%

Description

An m x n cake is to be cut into 1 x 1 unit pieces. You are given horizontalCut of size m - 1 and verticalCut of size n - 1, representing cut costs. Each cut splits one piece and costs a fixed amount regardless of how many pieces already exist.

Return the minimum total cost to reduce the entire cake to unit pieces.

Code

1
2
3