Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Build a dp array where dp[i][j] is the minimum cost to achieve all the cuts between i and j.
When you try to get the minimum cost between i and j, try all possible cuts k between them, dp[i][j] = min(dp[i][k] + dp[k][j]) + (j - i) for all possible cuts k between them.