Very Easy clean code | Variation of MCM
If you have seen Balloon Burst and this problem, not able to find the solution .\nJust read the following pattern carefully .\n\nThese both are the child proble
If you have seen Balloon Burst and this problem, not able to find the solution .\nJust read the following pattern carefully .\n\nThese both are the child problem of MCM .\n\nIf you have seen Balloon Burst and this problem, not able to find the solution .\nJust read the following pattern carefully .\n\nThese both are the child problem of MCM .\n\n```\nclass Solution {\npublic:\n    int dp[51][51];\n    int solve(vector<int>& values, int i, int j){\n        //base case\n        if(i>=j) return 0;\n        if(dp[i][j]!=-1) return dp[i][j];\n        \n        int ans = INT_MAX;\n        for(int k = i; k<=j-1; k++){\n            int temp = solve(values, i, k) + solve(values, k+1, j) + (values[i-1]*values[k]*values[j]) ;\n            ans = min(ans,temp);\n        }\n        return dp[i][j] = ans;\n    }\n    int minScoreTriangulation(vector<int>& values) {\n        memset(dp,-1,sizeof(dp));\n        return solve(values, 1 , values.size()-1);  \n    }\n};\n```
[]