C++ || EASY DP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long dp[100000][2];\n    long long vp(int j, vector<int>& nums, bool k) {\n        if (j >= nums.size()) return 0;\n        if (dp[j][k] != -1) {\n            return dp[j][k];\n        }\n        \n        long long ans = 0;\n        if (k && nums[j] < 0) {\n            ans = max(vp(j + 1, nums, true) + nums[j], vp(j + 1, nums, false) - nums[j]);\n        } else {\n            ans = nums[j] + vp(j + 1, nums, true);\n        }\n        return dp[j][k] = ans;\n    }\n    \n    long long maximumTotalCost(vector<int>& nums) {\n        memset(dp, -1, sizeof(dp));\n        return nums[0] + vp(1, nums, true);\n    }\n};\n\n```
['C++']