Typescript with hashmap + sliding window, O(n) time
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```typescript []\nfunction maximumUniqueSubarray(nums: number[]): number {\n    const map = new Map<number, number>()\n    let sum = 0, max = 0, left = 0\n    for (let i=0; i<nums.length; i++) {\n        map.set(nums[i], (map.get(nums[i]) || 0) + 1)\n        sum += nums[i]\n        while (map.get(nums[i]) as number > 1) {\n            map.set(nums[left], (map.get(nums[left]) as number) - 1)\n            sum -= nums[left]\n            left++\n        }\n        max = Math.max(max, sum)\n    }\n    return max\n};\n```
['TypeScript']