Maximum Erasure Value
C++ Code\n\nint maximumUniqueSubarray(vector<int>& nums) {\n        int n= nums.size(),psum=0,mx=0,j=0,count=-1; unordered_map<int, pair<int, int>>m;\n        f
**C++ Code**\n```\nint maximumUniqueSubarray(vector<int>& nums) {\n        int n= nums.size(),psum=0,mx=0,j=0,count=-1; unordered_map<int, pair<int, int>>m;\n        for(int i=0; i<n; i++)\n        {\n            psum+=nums[i];\n            if(m.find(nums[i])!=m.end() && m[nums[i]].second >=j )\n                {\n                        mx= max(mx, psum-m[nums[j]].first-nums[i]+nums[j]);\n                        j = m[nums[i]].second+1; \n                }    \n            m[nums[i]]={psum,i};\n            }\n            mx=max(mx,psum-m[nums[j]].first + nums[j]);\n        return mx;\n    }\n```
['C']