[C++] O(n) time O(1) memory
\n```\nclass Solution {\npublic:\n    int maximumSum(vector& arr) {\n        int with_deletion = 0;          //  one deleted out.\n        int without_deletion 
\n```\nclass Solution {\npublic:\n    int maximumSum(vector<int>& arr) {\n        int with_deletion = 0;          //  one deleted out.\n        int without_deletion = arr[0];  //  not deleted yet.\n        int ans = without_deletion;\n        for(int i = 1; i<arr.size(); i++) {\n            with_deletion = max({without_deletion, with_deletion+arr[i]}); // previous deletion or drop current element\n            without_deletion =max({arr[i], without_deletion+arr[i]});      // with previous sum or not\n            ans = max({ans,with_deletion, without_deletion});\n        }\n        return ans;\n    }\n};
[]