C++ | Recursion | Memoization
\nint dp[100001][2];\n    int solve(int i,int n,vector<int>& arr,int deletionPossible)\n    {\n        if(i>=n)\n            return 0;\n        if(deletionPossi
```\nint dp[100001][2];\n    int solve(int i,int n,vector<int>& arr,int deletionPossible)\n    {\n        if(i>=n)\n            return 0;\n        if(deletionPossible<0)\n            return 0;\n        if(dp[i][deletionPossible]!=-1)\n            return dp[i][deletionPossible];\n        return dp[i][deletionPossible]=max(arr[i]+solve(i+1,n,arr,deletionPossible),solve(i+1,n,arr,deletionPossible-1));\n    }\n    int maximumSum(vector<int>& arr) {\n        int i,n=arr.size(),cnt=0,maxi=INT_MIN;\n        for(i=0;i<n;i++)\n        {\n            if(arr[i]>=0)\n                ++cnt;\n            maxi=max(maxi,arr[i]);\n        }\n        if(cnt==0)\n            return maxi;\n        memset(dp,-1,sizeof(dp));\n        int ans=-1;\n        for(i=0;i<n;i++)\n        {\n            ans=max(ans,solve(i,n,arr,1));\n        }\n        return ans;\n    }\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'C']