You are viewing a single comment's thread. Return to all comments →
C++ solution
int sockMerchant(int n, vector<int> ar) { map<int,int> socks; int pairsock=0; for (int i =0; i<n; i++) { socks[ar[i]]++; } for(auto &pair : socks){ pairsock += pair.second/2; } return pairsock; }
Sales by Match
You are viewing a single comment's thread. Return to all comments →
C++ solution