Just Matrix Chain Multiplication 😋!!!
Just observe the test cases and your calculated output and do keep in mind the problem of matrix chain multiplication. You will find that it\'s basically exactl
Just observe the test cases and your calculated output and do keep in mind the problem of matrix chain multiplication. You will find that it\'s basically exactly the same.\n\n```\nclass Solution {\npublic:\n    int dp[51][51];\n    \n    int help(vector<int>& values, int l, int r)\n    {\n        if(l >= r)\n            return 0;\n        \n        int res = INT_MAX;\n        \n        if(dp[l][r] != -1)\n            return dp[l][r];\n        \n        for(int k=l;k<r;k++)\n        {\n            int tmp = help(values,l,k)+help(values,k+1,r)+values[l-1]*values[k]*values[r];\n            res = min(res, tmp);\n        }\n        \n        return dp[l][r] = res;\n    }\n    \n    int minScoreTriangulation(vector<int>& values) {\n        int n = values.size();\n        \n        memset(dp,-1, sizeof(dp));\n        \n        return help(values, 1, n-1);\n    }\n};\n```\n\nTime Complexity : O(n^3)\nSpace Complexity : O(n^2)
['C', 'Matrix', 'C++']