map<ll,ll> mp1=mp;
for(int i=0;i<n;i++)
{
if(mp1[a[i]])
mp1[a[i]]-- ;
else
a_rem.push_back(a[i]);
}
}
map<ll,ll> mp1=mp;
for(int i=0;i<n;i++)
{
if(mp1[a[i]])
mp1[a[i]]-- ;
else
a_rem.push_back(a[i]);
}
}
Please provide the full code snippet with proper formatting.
According to given lines
- Basically you are iterating a list
- When some element in that list has already occured in map we are decreasing its frequency by 1.
- but if not we are pushing it to some other vector for some unknown purposes.