C++ || sliding window || simple code
class Solution {\npublic:\n\n    int maximumUniqueSubarray(vector& nums) {\nint n=nums.size();\n        unordered_mapmp;\n        int sum=0;\n        int mx=0;\
class Solution {\npublic:\n\n    int maximumUniqueSubarray(vector<int>& nums) {\nint n=nums.size();\n        unordered_map<int,int>mp;\n        int sum=0;\n        int mx=0;\n        int i=0;\n        int j=0;\n        while(j<n)\n        {\n            sum+=nums[j];\n            mp[nums[j]]++;\n            \n            if(mp.size()==j-i+1)\n            {\n                mx=max(sum,mx);\n                j++;\n            }\n            \n            else  if(mp.size()<j-i+1)\n            {\n                while(mp.size()<j-i+1)\n            {\n                 sum=sum-nums[i];\n                mp[nums[i]]--;\n                if(mp[nums[i]]==0)\n                {\n                    mp.erase(nums[i]);\n                }\n                i++;\n            }\n               \n                j++;\n            }\n        }\n        return mx;\n    }\n};\n**kindly upvot if it helped**
['C']