Neat Java Solution
public int maxCoins(int[] nums) {\n        //DP: the result depends on the last burst balloon, which seprate the array into 2 subarray. \n        //DP: by addin
    public int maxCoins(int[] nums) {\n        //DP: the result depends on the last burst balloon, which seprate the array into 2 subarray. \n        //DP: by adding 1 to head and tail, DP[i,i]=0 and DP[i,i+2]=num[i]*num[i+1]*num[i+2]\n        int n=nums.length+2;\n        int[] newnums=new int[n];\n        for(int i=0;i<n-2;i++){\n            newnums[i+1]=nums[i];\n        }\n        newnums[0]=newnums[n-1]=1;\n        int[][] DP=new int[n][n];\n        for(int k=2;k<n;k++){\n            for(int l=0;l+k<n;l++){\n                int h=l+k;\n                for(int m=l+1;m<h;m++){\n                    DP[l][h]=Math.max(DP[l][h],newnums[l]*newnums[m]*newnums[h]+DP[l][m]+DP[m][h]);\n                }\n            }\n        }\n        return DP[0][n-1];\n    }
[]