Sliding window with unordered_map || c++ || faster
\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        \n        unordered_map<int,int> mp;\n        int n = nums.size();\n   
```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        \n        unordered_map<int,int> mp;\n        int n = nums.size();\n        int maxi = INT_MIN, sum=0, i =0, j=0;\n        while(i<n)\n        {\n          if(mp.count(nums[i]) and mp[nums[i]]>= j) \n          {\n              sum -= accumulate(nums.begin() + j ,nums.begin() + mp[nums[i]] +1, 0);\n               j = mp[nums[i]]+1;\n          }\n            else \n            {\n            sum += nums[i];\n            mp[nums[i]]=i;\n                i++;\n            }\n            maxi = max(maxi,sum);\n        }\n        return maxi;\n    }\n};\n```
['C', 'Sliding Window']