Ransom Note

Easy

Return true if ransomNote can be built from the letters of magazine.

Each letter in magazine may be used at most once.

Example 1

canConstruct()
Input
ransomNote = "a", magazine = "b"
Output
false

Example 2

canConstruct()
Input
ransomNote = "aa", magazine = "ab"
Output
false

Why

Only one `a` is available.
Constraints
1 <= ransomNote.length, magazine.length <= 10^5
Both strings are lowercase English letters.

Topics

StringsHash Table

Implement canConstruct in the editor and return the answer — printing it is never graded.