You are viewing a single comment's thread. Return to all comments →
C++ solution
int sockMerchant(int n, vector<int> ar) { int pair_count=0; sort(ar.begin(),ar.end()); for(int i=0; i<ar.size(); i++) { if(ar[i] == ar[i+1]) { pair_count++; i++; } } return pair_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