Javascript ||Time: 92 ms (100.00%), Space: 52.6 MB (95.00%)
\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumUniqueSubarray = function(nums) {\n    let map = new Int8Array(10001), high = 0, sum = 0;
```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumUniqueSubarray = function(nums) {\n    let map = new Int8Array(10001), high = 0, sum = 0;\n    \n    for(let left = 0, right = 0; right < nums.length; right++){\n        //map the numbers and add to the total sum\n        map[nums[right]]++;\n        sum += nums[right];\n        \n        //when a number appears for a second time move the left pointer by one & \n        //substract one number from sum until the reapeated number is removed once\n        while(map[nums[right]] > 1){\n            map[nums[left]]--;\n            sum -= nums[left++];\n        }\n        //highest becomes the top score between this run and the last\n        high = Math.max(high, sum);\n    }\n    return high;\n};\n```
['Sliding Window', 'JavaScript']