Understand the solution
Intuition\n Describe your first thoughts on how to solve this problem. \nthere arise 2 cases that are either delete that particular element on current index or 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nthere arise 2 cases that are either delete that particular element on current index or take that elementin sum.\n1) oneDelete: max(take that element if any element is previously deleted before this, delete this(nodelete))\n2) noDelete: max(start max sum subaray from this element, don\'t delete this element and add its value in subarray sum).\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N)\n# Code\n```\nclass Solution {\n    public int maximumSum(int[] arr) {\n        int n = arr.length;\n        int oneDelete = 0, noDelete = arr[0], max = arr[0];\n        for (int i = 1; i < n; i++) {\n            oneDelete = Math.max(oneDelete + arr[i], noDelete);\n            noDelete = Math.max(noDelete + arr[i], arr[i]);\n            max = Math.max(max, Math.max(oneDelete, noDelete));\n        }\n        return max;\n    }\n}\n```
['Java']