You are viewing a single comment's thread. Return to all comments →
working java solution
static int makingAnagrams(String s1, String s2){ // Complete this function int[] temp = new int[26]; for(int i=0,j=0;i<s1.length() || j<s2.length();i++,j++) { if(i<s1.length()) temp[s1.charAt(i)-'a']++; if(j<s2.length()) temp[s2.charAt(j)-'a']--; } int count=0; for(int i=0;i<26;i++) count+=Math.abs(temp[i]); return count;
}
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 →
working java solution
}