Easy · Strings

Ransom Note

Given ASCII-letter strings note and magazine, return true if note can be spelled from the letters of magazine with each magazine letter used at most once; otherwise return false.

Examples

Example 1

{
  "note": "aab",
  "magazine": "baa"
}

Output: true

Example 2

{
  "note": "aa",
  "magazine": "ab"
}

Output: false

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Strings problems