You are viewing a single comment's thread. Return to all comments →
simple python solution:
def ransom_note(magazine, ransom): for word in ransom: if not w in magazine: return False else: magazine.remove(word) return True m, n = map(int, raw_input().strip().split(' ')) magazine = raw_input().strip().split(' ') ransom = raw_input().strip().split(' ') print "Yes" if ransom_note(magazine, ransom) else "No"
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
simple python solution: