Dynamic Programming21 sections · 916 units
Open in Course

LeetCode 312 Burst Balloons - Problem Statement

LeetCode 312

You have nn balloons with numbers on them. Bursting balloon i gives you nums[i1]×nums[i]×nums[i+1]nums[i-1] \times nums[i] \times nums[i+1] coins. After bursting, the neighbors become adjacent. Find the maximum coins you can collect by bursting all balloons in the optimal order.

This looks like you could pick the locally best choice each time, but that approach fails. The order matters because bursting changes the neighbors. This is interval DP in disguise.