You are viewing a single comment's thread. Return to all comments →
What about even more Java 8 fun :D
public static int numberNeeded4(String one, String two){ int [] letters = new int[26]; one.chars().forEach( c -> { letters[c-'a']++; }); two.chars().forEach( c -> { letters[c-'a']--; }); return IntStream.of(letters).map( i -> Math.abs(i)).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 →
What about even more Java 8 fun :D