✅Accepted| | ✅Easy solution || ✅Short & Simple || ✅Best Method
\n# Code\n\nclass Solution {\npublic:\n    int maxCoins(vector<int>& nums) {\n       int n=nums.size();\n       nums.insert(nums.begin(), 1);\n       nums.push_
\n# Code\n```\nclass Solution {\npublic:\n    int maxCoins(vector<int>& nums) {\n       int n=nums.size();\n       nums.insert(nums.begin(), 1);\n       nums.push_back(1);\n       vector<vector<int>> dp(n+2, vector<int>(n+2, 0));\n       for(int l=1;l<=n;l++) {\n           for(int i=1;i<=n-l+1;i++) {\n               int j=i+l-1;\n               for(int k=i;k<=j;k++)\n               {\n                   int cost=nums[i-1]*nums[k]*nums[j+1]+dp[i][k-1]+dp[k+1][j];\n                   dp[i][j]=max(dp[i][j], cost);\n               }\n           }\n       }\n       return dp[1][n];\n    }\n};\n```\nPlease **UPVOTE** if it helps \u2764\uFE0F\uD83D\uDE0A\nThank You and Happy To Help You!!
['C++']