You are viewing a single comment's thread. Return to all comments →
static boolean isAnagram(String a, String b) { String strA = a.toLowerCase(); String strB = b.toLowerCase();
char[] charA = strA.toCharArray(); char[] charB = strB.toCharArray(); java.util.Arrays.sort(charA); java.util.Arrays.sort(charB); boolean result = java.util.Arrays.equals(charA, charB); return result; }
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 strA = a.toLowerCase(); String strB = b.toLowerCase();