We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static boolean isAnagram(String a, String b) {
a = a.toLowerCase();
b = b.toLowerCase();
char[] ac = a.toCharArray();
char[] bc = b.toCharArray();
java.util.Arrays.sort(ac);
java.util.Arrays.sort(bc);
return String.valueOf(ac).equals(String.valueOf(bc));
}
Java Anagrams
You are viewing a single comment's thread. Return to all comments →