DP Java
Try all possible combinations.\n\n\nLet Minimum Cost of triangulation of vertices from i to j be min(i, j)\nIf j <= i + 2 Then\n  min(i, j) = 0\nElse\n  min(i, 
Try all possible combinations.\n\n```\nLet Minimum Cost of triangulation of vertices from i to j be min(i, j)\nIf j <= i + 2 Then\n  min(i, j) = 0\nElse\n  min(i, j) = Math.min { min(i, k) + min(k, j) + (A[i]*A[j]*A[k]) }  i+1<=k<=j-1\n```\n\n```\npublic int minScoreTriangulation(int[] A) {\n        int n = A.length;\n        if (n < 3) {\n            return 0;\n        }\n        int[][] dp = new int[n][n];\n        for (int gap = 0; gap < n; gap++) {\n            for (int i = 0, j = gap; j < n; i++, j++) {\n                if (j>=i+2) {\n                    dp[i][j] = Integer.MAX_VALUE;\n                    for (int k = i+1; k < j; k++) {\n                        int val = (A[i]*A[j]*A[k])+dp[i][k]+dp[k][j];\n                        dp[i][j] =Math.min(dp[i][j],val);\n                    }\n                }\n            }\n        }\n        return  dp[0][n-1];\n    }\n```
[]