Intuition
Complexity
Runtime
Space
Code
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
d = defaultdict(int)
for l in magazine:
d[l] += 1
for l in ransomNote:
if l not in d or d[l] < 1:
return False
d[l] -= 1
return TrueNotes
Cards
START Basic Front: Ransom Note Back: END