✅ C++ ||Simple Solution || Hashmap || Sliding Window
Also Try https://leetcode.com/problems/longest-substring-without-repeating-characters/  with same Approach\n\n\nclass Solution {\npublic:\n    int maximumUnique
Also Try https://leetcode.com/problems/longest-substring-without-repeating-characters/  with same Approach\n\n```\nclass Solution {\npublic:\n    int maximumUniqueSubarray(vector<int>& nums) {\n       unordered_map<int,int>mp;\n        int maxi=0;\n        int i=0;\n        int j=0;\n        int sum=0;\n        while(j<nums.size()){\n            sum+=nums[j];\n            mp[nums[j]]++;\n            if(mp.size()<j-i+1){\n                while(mp.size()<j-i+1){\n                    mp[nums[i]]--;\n                    sum-=nums[i];\n                    if(mp[nums[i]]==0) mp.erase(nums[i]);\n                    i++;\n                }\n             }\n           maxi=max(maxi,sum);\n           j++;  \n        }\n        return maxi;\n    }\n};\n```
['C', 'Sliding Window', 'C++']