You are viewing a single comment's thread. Return to all comments →
My Solution
import string def number_needed(a,b): count = 0 my_dict = dict.fromkeys(string.ascii_lowercase, []) for c in string.ascii_lowercase: if c in a and c in b: my_dict[c] = [a.count(c),b.count(c)] elif c in a and c not in b: my_dict[c] = [a.count(c), 0] else: my_dict[c] = [0, b.count(c)] for c in string.ascii_lowercase: count += abs(my_dict[c][1] - my_dict[c][0]) return count
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 →
My Solution