1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/赎金信 [ransom-note].html
2022-03-29 12:43:11 +08:00

38 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你两个字符串:<code>ransomNote</code><code>magazine</code> ,判断 <code>ransomNote</code> 能不能由 <code>magazine</code> 里面的字符构成。</p>
<p>如果可以,返回 <code>true</code> ;否则返回 <code>false</code></p>
<p><code>magazine</code> 中的每个字符只能在 <code>ransomNote</code> 中使用一次。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>ransomNote = "a", magazine = "b"
<strong>输出:</strong>false
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>ransomNote = "aa", magazine = "ab"
<strong>输出:</strong>false
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>ransomNote = "aa", magazine = "aab"
<strong>输出:</strong>true
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= ransomNote.length, magazine.length &lt;= 10<sup>5</sup></code></li>
<li><code>ransomNote</code><code>magazine</code> 由小写英文字母组成</li>
</ul>