Search⌘ K
AI Features

Solution: Burst Balloons

Discover how to solve the Burst Balloons problem with dynamic programming by reversing the approach to bursting balloons last in given intervals. Explore building a 2D DP table to find the maximum coins possible, and understand the time and space complexities involved in this optimization problem.

Statement

You are given nn balloons, numbered from 00 to n1n - 1. Each balloon has a number painted on it, represented by an integer array nums.

When you burst a balloon ii, you earn coins equal to nums[i - 1] * nums[i] * nums[i + 1].
If either i1i - 1 or i+1i + 1 ...