You are viewing a single comment's thread. Return to all comments →
c++
int sockMerchant(int n, vector<int> ar) { unordered_map<int, int> frequencyMap; int nPairs = 0; for(int i = 0; i < ar.size(); ++i){ frequencyMap[ar[i]] += 1; if(frequencyMap[ar[i]] % 2 == 0){ nPairs +=1; } } return nPairs; }
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++