You are viewing a single comment's thread. Return to all comments →
In the same spirit here is my Java 8 solution for the lulz:
public static int numberNeeded(String first, String second) { int[] freq = new int[26]; first.chars().forEach((c) -> { freq[c - 97]++; }); second.chars().forEach((c) -> { freq[c - 97]--; }); return Arrays.stream(freq).map(Math::abs).sum(); }
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 →
In the same spirit here is my Java 8 solution for the lulz: