DP?
Approach\n Describe your approach to solving the problem. \nEvery number can be either have a negative multiplier or not: \n1. If nums[i] has negative multiplie
# Approach\n<!-- Describe your approach to solving the problem. -->\nEvery number can be either have a negative multiplier or not: \n1. If nums[i] has negative multiplier, then current cost = (max cost till nums[i-2]) + nums[i-1] - nums[i]\n2. If nums[i] has positive multiplier, then current cost = (max cost till nums[i-1]) + nums[i]\n\nMax cost till nums[i] = max of the two options\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\nclass Solution(object):\n    def maximumTotalCost(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        \n        L = len(nums)\n\n        if L == 1:\n            return nums[0]\n\n        p2 = 0\n        p1 = nums[0]\n\n        for i in range(1,L):\n            pn = max(p2 + nums[i-1] - nums[i], p1 + nums[i])\n            p2 = p1\n            p1 = pn\n        \n        return pn\n```
['Dynamic Programming', 'Python']