You are viewing a single comment's thread. Return to all comments →
int makingAnagrams(string s1, string s2) { unordered_map<char, int> mymap1; int i = 0, remove = 0; while(i < s1.size()) { mymap1[s1[i]] += 1; i++; } i = 0; while(i < s2.size()) { mymap1[s2[i]] -= 1; i++; } auto it = mymap1.begin(); while(it != mymap1.end()) { remove += abs(it->second); it++; } return remove; }
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →