C++ Easy | Memory O(1) Time O(n)
\nclass Solution {\npublic:\n  int maximumSum(vector<int>& arr) {\n    if (arr.size() <= 1) {\n      return arr[0];\n    }\n    const int n = arr.size();\n    i
```\nclass Solution {\npublic:\n  int maximumSum(vector<int>& arr) {\n    if (arr.size() <= 1) {\n      return arr[0];\n    }\n    const int n = arr.size();\n    int not_delete = max(arr[0] + arr[1], arr[1]);\n    int one_delete = max(arr[0], arr[1]);\n    int result = max(not_delete, one_delete);\n    for (int i = 2; i < n; ++i) {\n      one_delete = max(not_delete, one_delete + arr[i]);\n      not_delete = max(not_delete + arr[i], arr[i]);\n      result = max(result, max(one_delete, not_delete));\n    }\n    return result;\n  }\n};\n```
['C']