Python 3 Simple DP Solution in O(n^2)
Similar to what we saw in previous Stone Game, we can take use of choosing from the left/right margin. In each turn, no matter who is choosing, we want to find 
Similar to what we saw in previous Stone Game, we can take use of choosing from the left/right margin. In each turn, no matter who is choosing, we want to find the optimal case:\n```\nclass Solution:\n    def stoneGameVII(self, stones: List[int]) -> int:\n        length = len(stones)\n        csum = [0 for _ in range(length+1)]\n        for i in range(length):\n            csum[i+1] = csum[i] + stones[i]\n        dp = [[0 for _ in range(length)] for _ in range(length)]\n        for j in range(1, length):\n            for i in range(j-1, -1, -1):\n                left = csum[j+1] - csum[i+1] - dp[i+1][j]\n                right = csum[j] - csum[i] - dp[i][j-1]\n                dp[i][j] = max(left, right)\n        return dp[0][length-1]\n```
[]