Easy · Strings

Ransom note

Given two 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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Strings problems