Java Solution with O(N) Time and O(1) Space
\npublic int maximumSum(int[] arr) {\n        int N=arr.length, sum_with_delete=arr[0], sum_without_delete=arr[0], result=Integer.MIN_VALUE;\n        if(N==1){\
```\npublic int maximumSum(int[] arr) {\n        int N=arr.length, sum_with_delete=arr[0], sum_without_delete=arr[0], result=Integer.MIN_VALUE;\n        if(N==1){\n            return arr[0];\n        }\n        \n        for(int i=1;i<N;i++){\n            int sum_without_delete_temp=Math.max(sum_without_delete+arr[i], arr[i]);\n            sum_with_delete=Math.max(sum_without_delete, sum_with_delete+arr[i]);\n            sum_without_delete=sum_without_delete_temp;\n            \n            result=Math.max(result, Math.max(sum_with_delete, sum_without_delete));\n        }\n        \n        return result;\n    }\n```
['Dynamic Programming', 'Java']