Problem
You get an integer array nums. Each item is a balloon with a number on it. You must burst all the balloons, one at a time, in an order that you choose.
When you burst balloon i, you get left * nums[i] * right coins. Here, left and right are the numbers on the balloons next to balloon i at that time.
If no balloon is on one side, use 1 for that side. After a burst, the two neighbors of the burst balloon become adjacent.
Return the maximum number of coins that you can get.
Example 1
- Input:
- nums = [2,4,3]
- Output:
- 33
- Explanation:
- Burst 4 first for
2 * 4 * 3 = 24coins. Then burst 2 for1 * 2 * 3 = 6coins. Then burst 3 for1 * 3 * 1 = 3coins. The total is 33.
Example 2
- Input:
- nums = [6]
- Output:
- 6
- Explanation:
- No balloon is on either side, so you get
1 * 6 * 1 = 6coins.
Constraints
- 1 <= nums.length <= 300
- 0 <= nums[i] <= 100
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Minimum Number of Arrows to Burst Balloons
Coding · Array · Greedy · Sorting
- Maximum Number of Balloons
Coding
- 0/1 Knapsack Problem with Time Complexity Optimization
Coding
- 01 Matrix
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 3 records
Amazon
Leetcode 312. Burst Balloons
Reported Feb 27, 2026 · 2 source reports
MID_LEVEL
Source snapshot: Nov 12, 2026
View sourceApple
Leetcode 312. Burst Balloons
Reported Aug 31, 2026 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View sourceGoogle
Leetcode 312. Burst Balloons
Reported Jan 28, 2025 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source