You are viewing a single comment's thread. Return to all comments →
I came up with the same solution using python but I used a dictionary instead saving unnecessary loops when adding the values
a = dict() s = raw_input().strip() for c in s: a[c] = a.get(c, 0) + 1 s = raw_input().strip() for c in s: a[c] = a.get(c, 0) - 1 r = 0 for c in a: r = r + abs(a[c]) print r
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 →
I came up with the same solution using python but I used a dictionary instead saving unnecessary loops when adding the values