I am trying to solve the "Ransom Note" problem on hackerank. Why isn't my code getting submitted? What can I do differently? is my total time complexity, in this case, it is O(n^2)?
#!/bin/python3 import math import os import random import re import sys # Complete the checkMagazine function below. def checkMagazine(magazine, note): for word in note: # O(n) if word not in magazine: # O(n) return 'No' else: magazine.remove(word) # O(n) return 'Yes' if __name__ == '__main__': mn = input().split() m = int(mn) n = int(mn) magazine = input().rstrip().split() note = input().rstrip().split() print(checkMagazine(magazine, note))