232. Ransom Note

EasyHash Table

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.

Examples

Input: aab baa

Output: true

Explanation: magazine 'baa' has a:2, b:1 — enough for 'aab'.

Constraints

  • 1 <= ransomNote.length, magazine.length <= 10^5
  • ransomNote and magazine consist of lowercase English letters.
Loading...

Run checks all cases above. Submit evaluates all test cases.