What this lines of code doing ? please have a look ( map implementation )

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.

3 Likes

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.
1 Like