You are viewing a single comment's thread. Return to all comments →
Java:
public static int makeAnagram(String a, String b) { int numberOfDeletions = 0; for (int i = 0; i < a.length(); i++) { String currentCharacter = String.valueOf(a.charAt(i)); if(b.contains(currentCharacter)){ b = b.replaceFirst(currentCharacter, ""); } else { ++numberOfDeletions; } } return numberOfDeletions + b.length(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Java: