Burst Prize Balloons Problem

Burst Prize Balloons Problem — ExecCode Hard DSA Practice

Solve the Burst Prize Balloons problem on ExecCode. Free online hard DSA practice in DP. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Balloons sit in a row. Bursting balloon i scores nums[left] nums[i] nums[right] where left/right are the still-alive neighbors (treat missing neighbors as 1). The order of bursts changes the score completely, so greedy 'burst the largest' fails. Return the maximum coins you can collect by bursting all balloons. You are given: nums — positive integers, the balloon values Return maximum total coins (integer). You may burst balloons in any order. Neighbors are among remaining balloons, not original indices.

Examples

Input {'nums': [3, 1, 5, 8]}; Output 167. Input {'nums': [1, 5]}; Output 10. Input {'nums': [9]}; Output 9

Constraints

1 <= n <= 100

Practice Burst Prize Balloons free on ExecCode. Browse DSA problems, topic map, and placement guides.