#-*- coding: UTF-8 -*-
class Solution(object):
def canConstruct(self, ransomNote, magazine):
ransomNote=list(ransomNote)
magezine=list(magazine)
for ransom in ransomNote:
if(magezine.__contains__(ransom)):
point=magezine.index(ransom)
del magezine[point]
else:
return False
return True
sol=Solution()
print sol.canConstruct(‘aa‘, ‘aab‘)
时间: 2024-10-14 10:54:13