Skip to main content

Burst Balloons

Burst all balloons to get maximum coins Bursting balloon i gives nums[i-1] * nums[i] * nums[i+1] coins Out of bounds treated as 1 Example: [3,1,5,8] => 167 [3,1,5,8] -> [3,5,8] -> [3,8] -> [8] -> [] coins: 3*1*5 + 3*5*8 + 1*3*8 + 1*8*1 = 167

I stopped asking which balloon pops first. Ask which one pops last in each interval, and the subproblems stop overlapping.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Maximum Coins from Bursting Balloonshard
Based onLeetCode

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.