You are viewing a single comment's thread. Return to all comments →
This solution with some syntactic sugar:
int[] chars = new int[26]; for (char c1 : s1.toCharArray()) { chars[c1-97]++; } for (char c2 : s2.toCharArray()) { chars[c2-97]--; } int count = 0; for(int i: chars) {count += Math.abs(i);} System.out.println(count);
Note on for-each in Java- http://stackoverflow.com/a/256861/3527434
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
This solution with some syntactic sugar:
Note on for-each in Java- http://stackoverflow.com/a/256861/3527434