Minimum Cost to Cut a Stick
HardLeetCodeAdvanced DP (Bitmask, Digit, Interval)
Approach hintTry it first, then revealHide
Sort the cuts and add both ends of the stick. Let dp[i][j] be the cheapest way to make every cut strictly between positions i and j; try each cut k as the first one in that piece, paying the piece length. O(m^3).