You are viewing a single comment's thread. Return to all comments →
My C++ Solution:
int makingAnagrams(string s1, string s2) { unordered_map<char, int> mp; int deletions = 0; for(auto c: s1){ mp[c]++; } for(auto c: s2){ if(mp[c]) mp[c]--; else{ deletions++; } } for(auto item : mp){ if(item.second > 0){ deletions += item.second; } } return deletions; }
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 →
My C++ Solution: