Maximum Erasure Value Daily June ,Day12,22
\nSteps:-\n       Step 1: Creating prefix sum array\n\t   Step 2: Iterating over nums from index 1 and initialized the result with res=nums[0]\n\t   Step 3: Usi
```\nSteps:-\n       Step 1: Creating prefix sum array\n\t   Step 2: Iterating over nums from index 1 and initialized the result with res=nums[0]\n\t   Step 3: Using unordered_map cheching if element already present or not,\n\t   Step 4: If present then checking if the index is greater than the start index. If True then updating the result (res) with max(res,(sum of elements between i th index and start index).\n\t   Step 5: Also at last updating the res with max(res,(sum of elements between i th index and start index), because if iterator i have reached at last of nums.\n\t   Step 6:return the result (here res).\n\t   \nCode:\n int maximumUniqueSubarray(vector<int>& nums) {\n        int res=nums[0],s=0,start=0,i=0;\n        vector<int>v;unordered_map<int,int>m;\n        for (auto x:nums)\n        {\n            s+=x;\n            v.push_back(s);\n        }\n       \n        m[nums[0]]=0;\n        for(i=1;i<nums.size();i++)\n        {\n            if(m.find(nums[i])!=m.end() && m[nums[i]]>=start)\n            {\n               int ind=m[nums[i]];\n               res=max(res,(v[i-1]-v[start]+nums[start]));\n               start=ind+1;         \n            }\n            m[nums[i]]=i; \n        }\n      \n        res=max(res,v[i-1]-v[start]+nums[start]);\n        return res;\n    }\n```
['C', 'Sliding Window', 'Prefix Sum']