1270. Letter of blackmail
Chinese
English
Given an arbitrary string representing the content of the extortion letter, and another string representing the contents of the magazine, write a method to determine whether the extortion letter can be constructed by cutting out the contents of the magazine, and if so, return true; Otherwise it returns false.
Each character in the magazine string can only be used once in the extortion letter.
Sample
Sample 1
输入 : ransomNote = "aa", magazine = "aab"
输出 : true
解析 : 勒索信的内容可以有杂志内容剪辑而来
Sample 2
输入 : ransomNote = "aaa", magazine = "aab"
输出 : false
解析 : 勒索信的内容无法从杂志内容中剪辑而来
Precautions
You can think of both strings as containing only lowercase letters.