DP || Pick/ Not Pick || O(n)
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: O(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 {\n    fun maximumTotalCost(nums: IntArray): Long {\n        if (nums.size == 1) return nums[0].toLong();\n        if (nums.size == 2) {\n            return maxOf(nums[0] + nums[1], nums[0] - nums[1]).toLong();\n        }\n\n        var a:  Array<LongArray> = Array(nums.size, {LongArray(2) {0}})\n        a[0][0] = nums[0].toLong();\n        a[1][0] = a[0][0] + nums[1];\n        a[1][1] = a[0][0] - nums[1];\n\n        for (i in 2 until nums.size) {\n            a[i][0] = maxOf(a[i-1][0] + nums[i], a[i-1][1] + nums[i])\n            a[i][1] = a[i-1][0] - nums[i];\n        }\n\n        return maxOf(a[nums.size-1][0], a[nums.size-1][1])\n    }\n}\n```
['Dynamic Programming', 'Kotlin']