Easy solution || using Recursion or Memoization or Tabulation ||
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nint solve(vector<int>& val,int i,int j){\n    //  base case\n    if(i+1==j) return 0;\n\n    //  for choices for k we have use the loop from i+1 to j-1 choices\n    int ans=INT_MAX;\n    for(int k=i+1;k<j;k++){\n        ans=min(ans,val[i]*val[k]*val[j]+solve(val,i,k)+solve(val,k,j));\n    }\n    return ans;\n}\n// solve using memoisation \nint solveMemo(vector<int>& val,int i,int j,vector<vector<int>>&dp){\n    //  base case\n    if(i+1==j) return 0;\n     if(dp[i][j]!=-1) return dp[i][j];\n    //  for choices for k we have use the loop from i+1 to j-1 choices\n    int ans=INT_MAX;\n    for(int k=i+1;k<j;k++){\n        ans=min(ans,val[i]*val[k]*val[j]+solveMemo(val,i,k,dp)+solveMemo(val,k,j,dp));\n    }\n    return dp[i][j]=ans;\n}\n// using tabulation method\nint solveTab(vector<int>& val){\n    int n=val.size();\n    vector<vector<int>>dp(n,vector<int>(n,0));\n    for(int i=n-1;i>=0;i--){\n        for(int j=i+2;j<n;j++){\n        \n    int ans=INT_MAX;\n    for(int k=i+1;k<j;k++){\n        ans=min(ans,val[i]*val[k]*val[j]+dp[i][k]+dp[k][j]);\n            }\n        dp[i][j]=ans;\n        }\n    }\n    return dp[0][n-1];\n}\n    int minScoreTriangulation(vector<int>& values) {\n        //  this pattern is called mcm pattern\n        // return solve (values,0,values.size()-1);\n       \n        // int n=values.size();\n        // vector<vector<int>>dp(n,vector<int>(n,-1));\n        // return solveMemo(values,0,n-1,dp);\n\n        // using tabulation method\n        return solveTab(values);\n    }\n};\n```
['C++']