Simple Python, 5 lines, O(N) time, O(1) space
We only need to track two variables: the maximum sum we can get (with / without) a deletion.\n\nFor the maximum without a deletion, it is purely Kadane\'s algor
We only need to track two variables: the maximum sum we can get (with / without) a deletion.\n\nFor the maximum without a deletion, it is purely Kadane\'s algorithm.\n\nFor the maximum with a deletion, we can either discard current number, or, add current number to previous maximum with a deletion.\n\n```\nclass Solution:\n    def maximumSum(self, arr: List[int]) -> int:\n        maxi = modified = unmodified = float(\'-inf\')\n        \n        for n in arr:\n            modified, unmodified = max(unmodified, modified + n), max(0, unmodified) + n\n            \n            maxi = max(maxi, modified, unmodified)\n\n        return maxi\n```
[]