JAVA 4ms Solution, short and precise O(n) With Explanation
\npublic int maximumSum(int[] arr) {\n        int del = arr[0], res = arr[0], keep=arr[0];\n        int n = arr.length;\n        for(int i =1; i < n; i++){\n   
```\npublic int maximumSum(int[] arr) {\n        int del = arr[0], res = arr[0], keep=arr[0];\n        int n = arr.length;\n        for(int i =1; i < n; i++){\n            del = Math.max(keep, del + arr[i]);\n            keep = Math.max(keep + arr[i], arr[i]);\n            res = Math.max(res, Math.max(del,keep));\n        }\n        return res;\n    }\n```\nSo basically we keep three variables\nkeep - Kandane Algorithm  max value for either previous sum + current current element or just the current element\ndel - we make a simple sub problem i.e max value of previous sum(remove current element) or removed val + current element\nres- decides who did best! \ncheers
[]