You are viewing a single comment's thread. Return to all comments →
def checkMagazine(magazine, note): result = 0 word_dict = {} for i in range(len(magazine)): word_dict[magazine[i]] = word_dict.get(magazine[i], 0) + 1 for word in note: word_dict[word] = word_dict.get(word, 0) - 1 if word_dict[word] < 0: return print("No") print("Yes")
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →