728x90
https://leetcode.com/problems/ransom-note/
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
maga = list(magazine)
for l in ransomNote:
if not l in maga:
return False
else:
maga.remove(l)
return True
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 2042. Check if Numbers Are Ascending in a Sentence (0) | 2023.08.14 |
---|---|
[Leetcode] 27. Remove Element (0) | 2023.08.11 |
[Leetcode] 511. Game Play Analysis I (0) | 2023.08.10 |
[Leetcode] 1342. Number of Steps to Reduce a Number to Zero (0) | 2023.08.09 |
[Leetcode] 412. Fizz Buzz (0) | 2023.08.09 |