You are viewing a single comment's thread. Return to all comments →
static boolean isAnagram(String a, String b) { String str1=a.toLowerCase().replaceAll(" ", ""); String str2=b.toLowerCase().replaceAll(" ","");
int freqarray[]=new int[26];
// build buket array
for(int i=0;i
freqarray[str1.charAt(i)-'a']++;
} for(int i=0;i
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Anagrams
You are viewing a single comment's thread. Return to all comments →
static boolean isAnagram(String a, String b) { String str1=a.toLowerCase().replaceAll(" ", ""); String str2=b.toLowerCase().replaceAll(" ","");
// build buket array
for(int i=0;i
} for(int i=0;i
for(int i=0;i