You are viewing a single comment's thread. Return to all comments →
It was a damn simple problem you can solve it by sorting both the arrays(by taking character arrays) and checking if they are equal
static boolean isAnagram(String A, String B) { char a[]=A.toLowerCase().toCharArray(); char b[]=B.toLowerCase().toCharArray();
Arrays.sort(a); Arrays.sort(b); return Arrays.equals(a,b);
}
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 →
It was a damn simple problem you can solve it by sorting both the arrays(by taking character arrays) and checking if they are equal
static boolean isAnagram(String A, String B) { char a[]=A.toLowerCase().toCharArray(); char b[]=B.toLowerCase().toCharArray();
}