You are viewing a single comment's thread. Return to all comments →
int sockMerchant(int n, vector<int> ar) { unordered_map<int,int> map; for(int i=0;i<n;i++)map[ar[i]]++; int ans=0; unordered_map<int,int>::iterator itr=map.begin(); while(itr!=map.end()){ ans+=(itr->second)/2; itr++; } return ans; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →