Simple Recursive DP
Complexity\n- Time complexity: O(2N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(2N)\n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity: O(2*N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(2*N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long dp[100001][2];\n    long long go(int i, int pos, vector<int>& nums)\n    {\n        if (i == nums.size())\n            return 0;\n        if (dp[i][pos]!=-1)\n            return dp[i][pos];\n        if (pos)\n        {\n            return dp[i][pos] = nums[i] + go(i+1, 1-pos, nums);\n        }\n        return dp[i][pos] = max(-nums[i] + go(i+1, 1-pos, nums), nums[i] + go(i+1, pos, nums));\n    }\n    long long maximumTotalCost(vector<int>& nums) {\n        memset(dp, -1, sizeof(dp));\n        return go(0,1,nums);\n    }\n};\n\n\n```
['C++']