Beats 100% | Java | Matrix Chain Multiplication
\n# Complexity\n- Time complexity: n^2\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: n^2\n Add your space complexity here, e.g. O(n) \n\n# 
\n# Complexity\n- Time complexity: n^2\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: n^2\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    int[][] dp;\n    public int minScoreTriangulation(int[] values) {\n        int l=values.length;\n        dp = new int[l][l];\n        for(int[] i : dp) Arrays.fill(i,-1);\n        return solve(values,1,l-1); \n    }\n\n    public int solve(int[] values, int i,int j)\n    {\n        if(i>=j) return 0;\n        if(dp[i][j]!=-1) return dp[i][j];\n        int min=Integer.MAX_VALUE;\n        for(int k=i;k<j;k++)\n        {\n            int temp=solve(values,i,k)+solve(values,k+1,j)+\n                        values[i-1]*values[k]*values[j];\n            min=Math.min(min,temp);\n        }\n\n        return dp[i][j]=min;\n    }\n}\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Matrix', 'Java']