O(N) Time O(1) Space Sliding Windows Java Solution
Similiar to the sliding window approach to find maximum subarray without deletion, we maintain a both sum0 and sum1 during the evaluation.\n\n\n  public int max
Similiar to the sliding window approach to find maximum subarray without deletion, we maintain a both sum0 and sum1 during the evaluation.\n\n```\n  public int maximumSum(int[] arr) {\n    int n = arr.length;\n    int sum0 = 0;       // sum without deletion up in current sliding window\n    int sum1 = 0;       // sum with one possible deletion in current sliding window\n    int vmax = arr[0];  // maximum value in the array\n    int ans = 0;\n    for (int i = 0; i < n; i++) {\n      vmax = Math.max(vmax, arr[i]);\n      if (arr[i] >= 0) {\n        sum1 += arr[i];\n      } else {\n        sum1 = Math.max(sum0, sum1 + arr[i]);\n      }\n      sum0 += arr[i];\n      ans = Math.max(ans, sum1);\n      if (sum0 < 0) {\n        sum0 = 0;\n      }\n      if (sum1 <= 0) {\n        sum1 = 0;\n      }\n    }\n    return vmax <= 0 ? vmax : ans;\n  }\n\n```
[]