Ransom Note

Easy

Company Tags

You are given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise.

Each letter in magazine can only be used once in ransomNote.

Example 1:

Input: ransomNote = "aa", magazine = "aab"

Output: true

Example 2:

Input: ransomNote = "aa", magazine = "ab"

Output: false

Constraints:

  • 1 <= ransomNote.length, magazine.length <= 100,000
  • ransomNote and magazine consist of lowercase English letters.


Company Tags

Please upgrade to NeetCode Pro to view company tags.

ransomNote =

magazine =