HR_Hash Tables: Ransom Note
阿新 • • 發佈:2018-10-09
span math temp som 題目 clas strip UNC not
1 題目重點:whole words | case-sensitive
#!/bin/python3 import math import os import random import re import sys # Complete the checkMagazine function below. def checkMagazine(magazine, note): # m_len magazine n_len note m_len = len(magazine) n_len = len(note) # magazine = sorted(magazine)# note = sorted(note) for i in range(n): try: temp = magazine.index(note[i]) magazine[temp] = 0 except ValueError: return ‘No‘ return ‘Yes‘ if __name__ == ‘__main__‘: mn = input().split() m = int(mn[0]) n = int(mn[1]) magazine= input().rstrip().split() note = input().rstrip().split() print(checkMagazine(magazine, note))
HR_Hash Tables: Ransom Note