cpp
cpp\nint maximumSum(vector<int>& arr) {\n\tconst int len = arr.size();\n\tvector<int> dp(len, 0), dpr(len, 0);\n\tdp[0] = arr[0];\n\tdpr[len - 1] = arr.back();\
```cpp\nint maximumSum(vector<int>& arr) {\n\tconst int len = arr.size();\n\tvector<int> dp(len, 0), dpr(len, 0);\n\tdp[0] = arr[0];\n\tdpr[len - 1] = arr.back();\n\tint res = arr[0];\n\tfor (int i = 1; i < len; ++i) {\n\t\tdp[i] = max(dp[i - 1] + arr[i], arr[i]);\n\t\tres = max(res, dp[i]);\n\t}\n\tfor (int i = len - 2; i >= 0; --i) {\n\t\tdpr[i] = max(dpr[i + 1] + arr[i], arr[i]);\n\t\tres = max(res, dpr[i]);\n\t}\n\tfor(int i = 1; i < len - 1; ++i)\n\t\tres = max(dp[i - 1] + dpr[i + 1], res);\n\treturn res;\n}\n```
[]