You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution , you can find the video explanation here : https://youtu.be/HPIhFXx_DVM
int sockMerchant(int n, vector<int> ar) { map<int, int>mp; int result = 0; for(int i = 0; i < ar.size(); i++){ if(mp[ar[i]]){ result ++; mp.erase(ar[i]); continue; } mp[ar[i]]++; } return result; }
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 →
Here is my c++ solution , you can find the video explanation here : https://youtu.be/HPIhFXx_DVM