Python -- recursion approach
def helper(self,stone,tmp=0):\n        \n        if not stone:\n            return 0\n        \n        \n        \n        left = tmp - stone[-1] - self.helper
def helper(self,stone,tmp=0):\n        \n        if not stone:\n            return 0\n        \n        \n        \n        left = tmp - stone[-1] - self.helper(stone[:-1],tmp - stone[-1])    \n        right = tmp - stone[0] - self.helper(stone[1:], tmp - stone[0])\n        \n        \n        return max(left,right)    \n    \n    \n    def stoneGameVII(self, stones):\n        """\n        :type stones: List[int]\n        :rtype: int\n        """\n\n        \n        if not stones:\n            return 0\n        \n        tmp = sum(stones)\n        res = self.helper(stones,tmp)\n        \n        \n        return res
[]