You are viewing a single comment's thread. Return to all comments →
Unique solution by replacing found chars:
public static boolean isAnagram(String a, String b) { if (a.length() != b.length()) return false; a = a.toLowerCase(); b = b.toLowerCase(); for (int i=0;i<a.length();i++){ b= b.replaceFirst(String.valueOf(a.charAt(i)), ""); } return (b.equals("")) ? true : false; }
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 →
Unique solution by replacing found chars: