C++ using ans(left, i - 1) + ans(i + 1, right) for all i Kadane
\nint maximumSum(vector<int>& A)\n    {\n        int n = int(A.size());\n        vector<int> endHere(n), startHere(n);\n        endHere[0] = A[0];\n        for(
```\nint maximumSum(vector<int>& A)\n    {\n        int n = int(A.size());\n        vector<int> endHere(n), startHere(n);\n        endHere[0] = A[0];\n        for(int i = 1; i < n; ++i)\n            endHere[i] = max(endHere[i - 1] + A[i], A[i]);\n        startHere[n - 1] = A[n - 1];\n        for(int i = n - 2; i >= 0; --i)\n            startHere[i] = max(startHere[i + 1] + A[i], A[i]);\n        int ans = A[0];\n        for(int i = 1; i < n - 1; ++i)\n            ans = max({ans, endHere[i - 1] + startHere[i+1], endHere[i]});  // The answer can be either endHere[i] for all i as well\n        return max(ans, endHere[n - 1]);\n    }\n```
[]