O(n) CPP Easy Solution
```\n\nint maximumUniqueSubarray(vector& nums) {\n        unordered_setst;\n        int n=nums.size();\n        vectorprefix_sum(n);\n        prefix_sum[0]=nums
```\n\nint maximumUniqueSubarray(vector<int>& nums) {\n        unordered_set<int>st;\n        int n=nums.size();\n        vector<int>prefix_sum(n);\n        prefix_sum[0]=nums[0];\n        for(int i=1;i<n;i++){\n            prefix_sum[i]=prefix_sum[i-1]+nums[i];\n        }\n        int i=0, max_sum=0;\n        for(int j=0;j<n;j++){\n            while(st.find(nums[j])!=st.end()){\n                st.erase(nums[i]);\n                i++;\n            }\n            st.insert(nums[j]);\n            if(i==0)\n                max_sum=max(max_sum, prefix_sum[j]);\n            else\n                max_sum=max(max_sum, prefix_sum[j]-prefix_sum[i-1]);\n            \n        }\n        return max_sum;\n        \n    }
['Prefix Sum']