C++ || Sliding window || map || 1695. Maximum Erasure Value
\t//\tInitially we will keep our i and j pointer at index 0 \n\t//\tkeep moving j and add the current no to sum and \n\t//\talso add the curr no to map \n\t//\t
\t//\tInitially we will keep our i and j pointer at index 0 \n\t//\tkeep moving j and add the current no to sum and \n\t//\talso add the curr no to map \n\t//\tat each step update the ans\n\t//   whenever any element comes which is already in map\n\t//   then start increasing i pointer and erase nums[i]\n\t//   from map and also subtract it from sum\n\n\tclass Solution {\n\tpublic:\n\t\tint maximumUniqueSubarray(vector<int>& nums) {\n\t\t\tunordered_map<int,int>m;\n\t\t\tint sum=0,ans=0;\n\t\t\tint i=0,j=0,n=nums.size();\n\t\t\twhile(j<n)\n\t\t\t{\n\t\t\t\tsum+=nums[j];\n\t\t\t\twhile(m.find(nums[j])!=m.end())\n\t\t\t\t{\n\t\t\t\t\tsum-=nums[i];\n\t\t\t\t\tm.erase(nums[i]);\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tm[nums[j]]++;\n\t\t\t\tans=max(ans,sum);\n\t\t\t\tj++;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t};
['C', 'Sliding Window']