You are viewing a single comment's thread. Return to all comments →
My simple C++ solution :
int makingAnagrams(string s1, string s2){ int c1[26]={0}; int c2[26]={0}; int count=0; for(char x : s1) c1[x-'a']++; for(char y : s2) c2[y-'a']++; for(int i=0; i<26;i++) count+=abs(c2[i]-c1[i]); return count; }
Just mapped count of all chars in an alphabet array.
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 simple C++ solution :
Just mapped count of all chars in an alphabet array.