You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the balloons.
If you burst the ith balloon, 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.
Return the maximum coins you can collect by bursting the balloons wisely.
Input: nums = [3,1,5,8]
Input: nums = [1,5]
- n == nums.length
- 1 <= n <= 500
- 0 <= nums[i] <= 100