Simple Python DP solution
Inspired by the solution for Maximum Subarray Sum\n\n    def maximumSum(self, arr: List[int]) -> int:\n        n = len(arr)\n        max_ending_here = n * [arr[
Inspired by the solution for Maximum Subarray Sum\n```\n    def maximumSum(self, arr: List[int]) -> int:\n        n = len(arr)\n        max_ending_here = n * [arr[0]]\n        for i in range(1, n):\n            max_ending_here[i] = max(max_ending_here[i-1] + arr[i], arr[i])\n        return max(max_ending_here)\n```\n\nIt is not difficult to get this solution:\n```\n    def maximumSum(self, arr: List[int]) -> int:\n        n = len(arr)\n        max_ending_here0 = n * [arr[0]]  # no deletion\n        max_ending_here1 = n * [arr[0]]  # at most 1 deletion\n        for i in range(1, n):\n            max_ending_here0[i] = max(max_ending_here0[i-1] + arr[i], arr[i])\n            max_ending_here1[i] = max(max_ending_here1[i-1] + arr[i], arr[i])\n            if i >= 2:\n                max_ending_here1[i] = max(max_ending_here1[i], max_ending_here0[i-2] + arr[i])\n        return max(max_ending_here1)\n```\nSpace complexity can be easily improved to O(1).
[]