You are viewing a single comment's thread. Return to all comments →
Just change count.put(c, 1); to count.put(c, -1); in your second for loop. Then you just could sum the absolute values of both maps.
count.put(c, 1);
count.put(c, -1);
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Just change
count.put(c, 1);
tocount.put(c, -1);
in your second for loop. Then you just could sum the absolute values of both maps.