c++ memorized DFS solution in O(n^3) complexity
\nclass Solution {\npublic:\n    vector<vector<int>> dp;\n    int memorizedDFS(vector<int>& A, int start, int end){\n        if(start + 1 == end)\n            r
```\nclass Solution {\npublic:\n    vector<vector<int>> dp;\n    int memorizedDFS(vector<int>& A, int start, int end){\n        if(start + 1 == end)\n            return 0;\n        if(dp[start][end] != -1)\n            return dp[start][end];\n        \n        if(start + 2 == end){\n            dp[start][end] = A[start] * A[start+1] * A[end];\n            return dp[start][end];\n        }\n        int j = start + 1;\n        int res = INT_MAX;\n        while(j != end){\n            int a = memorizedDFS(A, start, j) + memorizedDFS(A, j, end) + A[start] * A[j] * A[end];\n            res = min(res, a);\n            j ++;\n        }\n        dp[start][end] = res;\n        return res;\n    }\n    int minScoreTriangulation(vector<int>& A) {\n        dp = vector<vector<int>>(A.size(), vector<int>(A.size(), -1));\n        int res = INT_MAX;\n        return memorizedDFS(A, 0, A.size()-1);\n    }\n};\n```
[]