Java Solution || Faster than 96%
\nclass Solution {\n    public int maximumUniqueSubarray(int[] nums) {\n        int res=0, sum=0;\n        boolean[] seen = new boolean[10001];\n        for (in
```\nclass Solution {\n    public int maximumUniqueSubarray(int[] nums) {\n        int res=0, sum=0;\n        boolean[] seen = new boolean[10001];\n        for (int i=0,j=0;i<nums.length;++i){\n            while(seen[nums[i]]){\n                seen[nums[j]] = false;\n                sum -= nums[j++];\n            }\n            seen[nums[i]] = true;\n            sum += nums[i];\n            res = Math.max(sum,res);\n        }\n        return res;\n    }\n}\n```
['Java']