C++ - two pointers, O(n) - faster than 93.5% time and 85% memory
\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int l = 0, r = 0, maxSum = 0, tempSum = 0;\n        vector<int> occuren
```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n        int l = 0, r = 0, maxSum = 0, tempSum = 0;\n        vector<int> occurences(1e4+1, 0);\n        while (r < nums.size()) \n\t\t\tif (occurences[nums[r]] == 0) {\n                occurences[nums[r]]++;\n                tempSum += nums[r];\n                maxSum = max(maxSum, tempSum);\n                r++;\n            } else {\n                occurences[nums[l]]--;\n                tempSum -= nums[l];\n                l++;\n            }\n        return maxSum;\n    }\n};\n```\n
['C']