Observation: This ques is same as Longest substring without repeating characters!
\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int l=0, r=0, n = nums.size();\n        \n        unordered_set<int> s;
```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int l=0, r=0, n = nums.size();\n        \n        unordered_set<int> s;\n        int sum=0, res=0;\n        \n        while(r<n) {\n            if(s.count(nums[r]) == 0) {\n                sum += nums[r];\n                res = max(res, sum);\n                s.insert(nums[r]);\n                r++;\n            } \n            \n            else {\n                s.erase(nums[l]);\n                sum=sum-nums[l];\n                l++;\n            }\n        }\n        \n        return res;\n    }\n};\n```
['Sliding Window']