You are viewing a single comment's thread. Return to all comments →
**C++ Solution **
int sockMerchant(int n, vector<int> ar) { int count = 0; map<int,int>mp; for(int i=0;i<n;i++){ mp[ar[i]]++; } for(auto it:mp){ if(it.second > 1){ count+= it.second/2; } } return count; }
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 →
**C++ Solution **