You are given a stick of length n with positions labeled from n. You must perform a cut at every position listed in cuts.
When you cut a stick segment, the cost of that cut equals the current length of the segment being cut. After making a cut, the segment is split into two smaller segments, and future cuts are applied to the appropriate resulting segment.
Return the minimum total cost to perform all cuts in cuts, where you may choose the order of cuts.
Constraints:
n
cuts.length $\leq \min(n
cuts[i] n
All integers in cuts are distinct.
You are given a stick of length n with positions labeled from n. You must perform a cut at every position listed in cuts.
When you cut a stick segment, the cost of that cut equals the current length of the segment being cut. After making a cut, the segment is split into two smaller segments, and future cuts are applied to the appropriate resulting segment.
Return the minimum total cost to perform all cuts in cuts, where you may choose the order of cuts.
Constraints:
n
cuts.length $\leq \min(n
cuts[i] n
All integers in cuts are distinct.