C++ O(n) time and O(1) space
\nclass Solution {\npublic:\n    int maximumSum(vector<int>& arr) {\n        int a = arr[0], b = a, c = a;\n        for (int i = 1; i < arr.size(); ++i) {\n    
```\nclass Solution {\npublic:\n    int maximumSum(vector<int>& arr) {\n        int a = arr[0], b = a, c = a;\n        for (int i = 1; i < arr.size(); ++i) {\n            b = max(a, b + arr[i]);\n            a = max(arr[i], a + arr[i]);\n            c = max(c, max(a, b));\n        }\n        return c;\n    }\n};\n```
[]