#-*- 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')
相关文章
- 【leetcode❤python】Ransom Note
- [LeetCode]题解(python):124-Binary Tree Maximum Path Sum
- [LeetCode]题解(python):050-Pow(x, n)
- Leetcode 283.移动零 By Python
- 随学随用的python-note
- LeetCode Majority Element Python
- [leetcode]Reverse Words in a String @ Python
- [LeetCode][Python]String to Integer (atoi)
- [LeetCode]题解(python):055-Jump Game
- [LeetCode]题解(python):064-Minimum Path Sum