python3 || 9 lines, pref and dict  || T/S:  99% / 44%
Here\'s the plan:\n1. We initialize vars and build a prefix array for nums.\n2. We use left to keep track of the starting index of the current subarray.\n3. We 
Here\'s the plan:\n1. We initialize `vars` and build a prefix array for `nums`.\n2. We use `left` to keep track of the starting index of the current subarray.\n3. We use `d` to keep track of the latest indexplus 1 for each value `n` in `nums`. \n4. We iterate through nums, updating `left` (if neccessary), `d`, and `ans`. We return `ans`.\n\n```\nclass Solution:\n    def maximumUniqueSubarray(self, nums: List[int]) -> int:\n\n        left, d = [0], defaultdict(int)\n        pref, ans = 0, 1\n\n        for n in nums:\n            pref.append(pref[-1]+n)\n\n        for idx, n in enumerate(nums):\n            if d[n] > left: left = d[n]\n            d[n] = idx+1\n\n            ans = max(ans, pref[idx+1] - pref[left])\n\n        return ans\n```\n[https://leetcode.com/problems/maximum-erasure-value/submissions/1279958488/](https://leetcode.com/problems/maximum-erasure-value/submissions/1279958488/)\n\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*), in which *N* ~ `len(nums)`.
['Python', 'Python3']