GoalScope — burst_balloons (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def burst_balloons(nums):↵
"""Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums.↵
You are asked to burst all the balloons. If you burst balloon i you will get nums[left] * nums[i] * nums[right] coins.↵
Here left and right are adjacent indices of i. After the burst, the left and right then becomes adjacent.↵
Find the maximum coins you can collect by bursting the balloons wisely."""↵
nums = [1] + nums + [1]↵
n = len(nums)↵
dp = [[0] * n for _ in range(n)]↵
↵
for length in range(2, n):↵
for left in range(n - length):↵
right = left + length↵
for i in range(left + 1, right):↵
dp[left][right] = max(dp[left][right], nums[left] * nums[i] * nums[right] + dp[left][i] + dp[i][right])↵
↵
return dp[0][n - 1]↵
</code>