Explaination video + simple top down code (memoization) C++ MCM based
\nclass Solution {\npublic:\n    int dp[500][500];\n    int helper(vector<int>& nums,int i,int j){\n        if(i>j)\n            return 0;\n        if(dp[i][j]!
```\nclass Solution {\npublic:\n    int dp[500][500];\n    int helper(vector<int>& nums,int i,int j){\n        if(i>j)\n            return 0;\n        if(dp[i][j]!=-1)\n            return dp[i][j];\n        int ans=0;\n        for(int k=i;k<=j;k++){\n            int curr=nums[i-1]*nums[k]*nums[j+1];\n            ans=max(ans,helper(nums,i,k-1)+helper(nums,k+1,j)+curr);\n        }\n        dp[i][j]=ans;\n        return ans;\n    }\n    int maxCoins(vector<int>& nums) {\n        nums.insert(nums.begin(),1);\n        nums.push_back(1);\n        memset(dp,-1,sizeof(dp));\n        return helper(nums,1,nums.size()-2);\n    }\n};\n```\n\nBest Explaination Video\nhttps://www.youtube.com/watch?v=KWPat-qNAGI
['Dynamic Programming', 'Memoization']