Python3 O(n) sliding window
\nclass Solution:\n    def maximumUniqueSubarray(self, nums: List[int]) -> int:\n        ans = float(\'-inf\')\n        cur = 0\n        # sliding window; curre
```\nclass Solution:\n    def maximumUniqueSubarray(self, nums: List[int]) -> int:\n        ans = float(\'-inf\')\n        cur = 0\n        # sliding window; current value = [i, j]\n        seen = set()\n        i = 0\n        for j in range(len(nums)):\n            while nums[j] in seen:\n                cur -= nums[i]\n                seen.remove(nums[i])\n                i += 1\n            seen.add(nums[j])\n            cur += nums[j]\n            ans = max(ans, cur)\n            \n        return ans\n```
[]