python dp solution
similar to maximum sum dp solution.\n1:dp[i]=max(dp[i-1]+arr[i],arr[i])\n2:dp1:ith end with one more deletion,ith end with no delete. dp0 still keep original fo
similar to maximum sum dp solution.\n1:dp[i]=max(dp[i-1]+arr[i],arr[i])\n2:dp1:ith end with one more deletion,ith end with no delete. dp0 still keep original formula.\ndelete happen in i or not in i=> dp1[i]=max(dp1[i-1]+arr[i],dp0[i-1])\n```\nclass Solution(object):\n    def maximumSum(self, arr):\n        if all(x<=0 for x in arr):#directly deal with corner case.\n            return max(arr)\n        n=len(arr)\n        dp0=[arr[i] for i in range(n)]\n        dp1=[0 for i in range(n)]\n        for i in range(1,n):\n            dp0[i]=max(dp0[i-1]+arr[i],arr[i])\n            dp1[i]=max(dp1[i-1]+arr[i],dp0[i-1])\n        return max(dp0+dp1)\n```\nSpace O(1)\n```\nclass Solution(object):\n    def maximumSum(self, arr):\n        if all(x<=0 for x in arr):#directly deal with corner case.\n            return max(arr)\n        n=len(arr)\n        res=dp0=arr[0]\n        dp1=0\n        for i in range(1,n):\n            dp1=max(dp1+arr[i],dp0)\n            dp0=max(dp0+arr[i],arr[i])\n            res=max(dp1,dp0,res)\n        return res
[]