Bursting Balloons — Solution & Editorial
Interval DP on the LAST balloon to burst in a range: dp[i][j] considering k as last-burst in (i, j) contributes ai·ak·aj with the two independent sub-intervals. Pad with 1s.
Complexity: O(N3)
Watch out: Think of the LAST balloon burst in an interval, not the first — the neighbours are then fixed.