recursion and memorisation
Start with recursion  hit the TLE :D\n\n    def minScoreTriangulation(self, A: List[int]) -> int:\n        def backtrack(start,end):\n            res = sys.maxs
Start with recursion  hit the TLE :D\n```\n    def minScoreTriangulation(self, A: List[int]) -> int:\n        def backtrack(start,end):\n            res = sys.maxsize\n            if end -start +1< 3:\n                    return 0\n            for i in range(start+1,end):\n                res = min(res,backtrack(start,i)+ backtrack(i,end)+ A[start]*A[end]*A[i])\n            return res\n        return backtrack(0,len(A)-1)\n```\nand use memorisation\n```\nclass Solution:\n    def minScoreTriangulation(self, A: List[int]) -> int:\n        cache ={}\n        def backtrack(start,end):\n            res = sys.maxsize\n            if end -start +1< 3:\n                    return 0\n            if (start,end) not in  cache:                \n                for i in range(start+1,end):\n                    res = min(res,backtrack(start,i)+ backtrack(i,end)+ A[start]*A[end]*A[i])\n                    cache[(start,end)] = res\n            return cache[(start,end)]\n        return backtrack(0,len(A)-1)\n```
['Backtracking', 'Memoization', 'Python']