Easy Sol time: O(N) space: O(1) in C++ with comments
author @jaiswalsahil844\n\nclass Solution {\npublic:\n    int maximumSum(vector<int>& a) {\n        \n\t\t// Kadane\'s Algo\n        // DP time: O(N) space: O(N
**author @jaiswalsahil844**\n```\nclass Solution {\npublic:\n    int maximumSum(vector<int>& a) {\n        \n\t\t// Kadane\'s Algo\n        // DP time: O(N) space: O(N)\n        // dp[i][2]-->dp[i][0]->suf_del and dp[i][1]->suf_no_del\n        \n        // Space optimized time: O(N) space: O(1)\n\t\tint n=a.size();\n        int suf_del=0; \n        int suf_no_del=a[0];\n        int ans=a[0];\n        for(int i=1;i<n;i++){\n            suf_del=max(suf_del+a[i],suf_no_del);       // suf_del\n            suf_no_del=max(suf_no_del+a[i],a[i]);       // suf_no_del\n            ans=max({ans,suf_del,suf_no_del});         \n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']