You are getting true, because the expected is true! ;)
"FYCENRD",
"KLNFINU",
"AAARAHR",
"NDKLPNE",
"ALANSAP",
"OOGOTPN",
"HPOLANO"
You are getting true, because the expected is true! ;)
"FYCENRD",
"KLNFINU",
"AAARAHR",
"NDKLPNE",
"ALANSAP",
"OOGOTPN",
"HPOLANO"
@xiaohan3 I think your algorithm is not O(n), dude. "in" and "remove" over lists are O(n) in python. Let's say n is the size of ransomNote and m the size of magazine, the code below is O(n*m):
for i in range(l1): # O(n)
if ransomNote[i] in s: # O(m)
s.remove(ransomNote[i]) # O(m)