2023-12-09 18:42:21 +08:00
< p > Given two strings < code > ransomNote< / code > and < code > magazine< / code > , return < code > true< / code > < em > if < / em > < code > ransomNote< / code > < em > can be constructed by using the letters from < / em > < code > magazine< / code > < em > and < / em > < code > false< / code > < em > otherwise< / em > .< / p >
2022-03-27 18:35:17 +08:00
< p > Each letter in < code > magazine< / code > can only be used once in < code > ransomNote< / code > .< / p >
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 18:35:17 +08:00
< pre > < strong > Input:< / strong > ransomNote = "a", magazine = "b"
< strong > Output:< / strong > false
2023-12-09 18:42:21 +08:00
< / pre > < p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 18:35:17 +08:00
< pre > < strong > Input:< / strong > ransomNote = "aa", magazine = "ab"
< strong > Output:< / strong > false
2023-12-09 18:42:21 +08:00
< / pre > < p > < strong class = "example" > Example 3:< / strong > < / p >
2022-03-27 18:35:17 +08:00
< pre > < strong > Input:< / strong > ransomNote = "aa", magazine = "aab"
< strong > Output:< / strong > true
< / pre >
< p > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > 1 < = ransomNote.length, magazine.length < = 10< sup > 5< / sup > < / code > < / li >
< li > < code > ransomNote< / code > and < code > magazine< / code > consist of lowercase English letters.< / li >
< / ul >