every blog every motto: You will never know unless you try
0. 前言
生活好难,再坚持坚持!
1. 字符串
1.1 题目
1.2
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
ran_freq = collections.Counter(ransomNote)
mag_freq = collections.Counter(magazine)
for ele in ransomNote:
if ran_freq[ele] > mag_freq[ele]:
return False
return True