Kadane Solution with O(n) time/space complexity
\nclass Solution {\n    public int maximumSum(int[] arr) {\n        if(arr.length ==1) return arr[0];\n        int[] forward = new int[arr.length];\n        int
```\nclass Solution {\n    public int maximumSum(int[] arr) {\n        if(arr.length ==1) return arr[0];\n        int[] forward = new int[arr.length];\n        int[] backward = new int[arr.length];\n        int max= arr[0];\n        int currentMax_forward = 0;\n        int currentMax_backward = 0;\n        \n        for(int i= 0; i< arr.length; i++){\n            currentMax_forward = Math.max(arr[i], arr[i] + currentMax_forward);\n            forward[i] = currentMax_forward;\n            max = Math.max(max, currentMax_forward); //keeping a track of maximum possible sum with deletion \n        }\n        \n        for(int i= arr.length-1; i>= 0; i--){\n            currentMax_backward = Math.max(arr[i], arr[i] + currentMax_backward);\n            backward[i] = currentMax_backward;\n        }\n        \n\t\t/**\n\t\t*keeping a track of maximum possible sum with single deletion!\n\t\t*Here we are starting deletion from arr[1] to arr[length-2] index\n\t\t*/\n        for(int i=0; i< arr.length-2; i++){\n            max = Math.max(max,forward[i] + backward[i+2]); \n        }\n        \n        max = Math.max(max, backward[1]); // lastly we compare the maximum by deleting arr[0] since we have already ran comparisons for all other permutations above\n        return max;\n    }\n}\n```
['Dynamic Programming', 'Java']