Java DP time: O(n) space: O(1)
public int maximumSum(int[] nums) {\n        if (nums == null || nums.length == 0) return 0;\n        if (nums.length == 1) return nums[0]; //if there is only o
public int maximumSum(int[] nums) {\n        if (nums == null || nums.length == 0) return 0;\n        if (nums.length == 1) return nums[0]; //if there is only one number, we can not delete it\n        int deleted = 0;  //(if we delete this number)\n        int undeleted = nums[0]; //(if we do not delete this number) \n        int res = nums[0];\n        for (int i = 1; i < nums.length; i++) {\n            deleted = Math.max(deleted + nums[i], undeleted);\n            undeleted = Math.max(undeleted + nums[i], nums[i]);\n            res = Math.max(res, Math.max(deleted, undeleted));\n        }\n        return res;\n    }
[]