Two Solutions in Python 3 (DP) (Top Down and Bottom Up)
DP - Top Down - With Recursion (Slower): (seven lines)\n\nclass Solution:\n    def minScoreTriangulation(self, A: List[int]) -> int:\n    \tSP, LA = [[0]*50 for
_DP - Top Down - With Recursion (Slower):_ (seven lines)\n```\nclass Solution:\n    def minScoreTriangulation(self, A: List[int]) -> int:\n    \tSP, LA = [[0]*50 for i in range(50)], len(A)\n    \tdef MinPoly(a,b):\n    \t\tL, m = b - a + 1, math.inf; \n    \t\tif SP[a][b] != 0 or L < 3: return SP[a][b]\n    \t\tfor i in range(a+1,b): m = min(m, A[a]*A[i]*A[b] + MinPoly(a,i) + MinPoly(i,b))\n    \t\tSP[a][b] = m; return SP[a][b]\n    \treturn MinPoly(0,LA-1)\n\t\t\n\t\t\n```\n_DP - Bottom Up - Without Recursion (Faster):_ (six lines)\n```\nclass Solution:\n    def minScoreTriangulation(self, A: List[int]) -> int:\n    \tSP, L = [[0]*50 for _ in range(50)], len(A)\n    \tfor i in range(2,L):\n    \t\tfor j in range(L-i):\n    \t\t\ts, e, SP[s][e] = j, j + i, math.inf\n    \t\t\tfor k in range(s+1,e): SP[s][e] = min(SP[s][e], A[s]*A[k]*A[e] + SP[s][k] + SP[k][e])\n    \treturn SP[0][L-1]\n\t\t\n\t\t\n- Junaid Mansuri\n(LeetCode ID)@hotmail.com
['Dynamic Programming', 'Python', 'Python3']