C++ O(n) sliding window with hash set
\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int result = 0;\n        unordered_set<int> hset;\n        for (int i =
```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int result = 0;\n        unordered_set<int> hset;\n        for (int i = 0, j = 0, win = 0; j < nums.size(); j++) {\n            while (hset.find(nums[j]) != hset.end()) {\n                hset.erase(nums[i]);\n                win -= nums[i];\n                i++;\n            }\n            hset.insert(nums[j]);\n            win += nums[j];\n            result = max(result, win);\n        }\n        return result;\n    }\n};\n```
[]