JavaScript Recursive: 60% time, 46% space
\nvar minScoreTriangulation = function(values) {\n    let dp = Array(values.length).fill().map((i) => Array(values.length).fill(0));\n    function dfs(i, j) {\n
```\nvar minScoreTriangulation = function(values) {\n    let dp = Array(values.length).fill().map((i) => Array(values.length).fill(0));\n    function dfs(i, j) {\n        if (dp[i][j]) return dp[i][j];\n        if (j - i < 2) return 0;\n        let min = Infinity;\n        // k forms a triangle with i and j, thus bisecting the array into two parts\n        // These two parts become two subproblems that can be solved recursively\n        for (let k = i + 1; k < j; k++) {\n            let sum = values[i] * values[j] * values[k] + dfs(i, k) + dfs(k, j);\n            min = Math.min(min, sum);\n        }\n        return dp[i][j] = min;\n    }\n    return dfs(0, values.length - 1);\n};\n```
['JavaScript']