diff --git a/LeetCode/0383_RansomNote.py b/LeetCode/0383_RansomNote.py new file mode 100644 index 0000000..4eb197b --- /dev/null +++ b/LeetCode/0383_RansomNote.py @@ -0,0 +1,6 @@ +class Solution: + def canConstruct(self, ransomNote: str, magazine: str) -> bool: + return all( + ransomNote.count(letter) <= magazine.count(letter) + for letter in set(ransomNote) + )