✅ Maximum Erasure Value | Easy Sliding Window Solution
\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        unordered_map<int,int> mp;\n        int i=0;\n        int sum=0;\n     
```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        unordered_map<int,int> mp;\n        int i=0;\n        int sum=0;\n        int ans=0;\n        for(int j=0;j<nums.size();j++)\n        {\n            sum+=nums[j];\n            mp[nums[j]]++;\n            while(mp[nums[j]]>1)\n            {\n                mp[nums[i]]--;\n                sum-=nums[i];\n                i++;\n            }\n            ans=max(sum,ans);\n            \n        }\n        return ans;\n        \n    }\n};\n```
['C']