EZ DP 🔥🔥
Code\n\nclass Solution:\n    def maximumTotalCost(self, nums: List[int]) -> int:            \n        @cache\n        def solve(curr,sign):\n            if curr
# Code\n```\nclass Solution:\n    def maximumTotalCost(self, nums: List[int]) -> int:            \n        @cache\n        def solve(curr,sign):\n            if curr>=len(nums):\n                return 0\n            \n            if sign:\n                return max(-nums[curr]+solve(curr+1,not sign),nums[curr]+solve(curr+1,sign))\n            else:\n                return nums[curr]+solve(curr+1,True)\n        return solve(0,False)\n        \n```
['Dynamic Programming', 'Memoization', 'Python3']