Simple, Easy and Faster O(n) solution
class Solution {\npublic:\n\n    int maximumUniqueSubarray(vector& nums)  {\n        unordered_map m;\n        vector arr(vector(nums.size(),0));\n        arr[0
class Solution {\npublic:\n\n    int maximumUniqueSubarray(vector<int>& nums)  {\n        unordered_map<int,int> m;\n        vector<int> arr(vector<int>(nums.size(),0));\n        arr[0] = nums[0];\n        \n        int max=0, prev=0,sum=0;\n        for(int i=0; i<nums.size(); i++) {\n            sum+=nums[i];\n            if(i!=0) {\n                arr[i] = nums[i]+arr[i-1];\n            }\n\n            if(m.find(nums[i])!=m.end() && m[nums[i]]>=prev) {\n                sum = arr[i]-arr[m[nums[i]]];\n                prev = m[nums[i]];\n            }\n            \n            m[nums[i]] = i;\n            if(sum>max)  max=sum;\n        }\n        \n        return max;\n    }\n};
['Two Pointers', 'C', 'Sliding Window']