这里写自定义目录标题 任务一任务二 任务一 Leetcode 383: class Solution: def canConstruct(self, ransomNote: str, magazine: str) -> bool: cnt = Counter(magazine) for c in ransomNote: cnt[c] -= 1 if cnt[c] < 0: return False return True 通过! ! 任务二