You are viewing a single comment's thread. Return to all comments →
Java 7 version:
public static int numberNeeded(String first, String second) { int count = 0; int[] freq = new int[26]; for (char c : first.toCharArray()) freq[c - 'a']++; for (char c : second.toCharArray()) freq[c - 'a']--; for (int i : freq) count += Math.abs(i); return count; }
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 7 version: