You are viewing a single comment's thread. Return to all comments →
Simple solution:
def number_needed(a, b): a, b = list(a), list(b) a_vals = list(a) for i in a_vals: if i in b: a.remove(i) b.remove(i) return len(a) + len(b)
Intuition: Remove all shared elements, count what's leftover.
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Simple solution:
Intuition: Remove all shared elements, count what's leftover.