Python O(N) solution, 6 lines, use dictionary
use a dictionary to keep the index of each number.\n\n    def maximumUniqueSubarray(self, nums: List[int]) -> int:\n        res, start, dic, sumDic = 0, 0, {}, 
use a dictionary to keep the index of each number.\n```\n    def maximumUniqueSubarray(self, nums: List[int]) -> int:\n        res, start, dic, sumDic = 0, 0, {}, {-1:0} \n        for i in range(len(nums)):\n            sumDic[i] = sumDic[i-1] + nums[i]\n            if nums[i] not in dic or dic[nums[i]] < start: \n                res = max(res, sumDic[i]-sumDic[start-1])\n            else: start = dic[nums[i]] + 1\n            dic[nums[i]] = i\n        return res    \n```
[]