leet-code/src/main/java/leetcode/editor/cn/ValidAnagram.md

30 lines
932 B
Markdown
Raw Normal View History

2021-07-11 23:27:42 +08:00
<p>给定两个字符串 <em>s</em><em>t</em> ,编写一个函数来判断 <em>t</em> 是否是 <em>s</em> 的字母异位词。</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong> <em>s</em> = "anagram", <em>t</em> = "nagaram"
<strong>输出:</strong> true
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> <em>s</em> = "rat", <em>t</em> = "car"
<strong>输出: </strong>false</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= s.length, t.length <= 5 * 10<sup>4</sup></code></li>
<li><code>s</code><code>t</code> 仅包含小写字母</li>
</ul>
<p> </p>
<p><strong>进阶: </strong>如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?</p>
<div><div>Related Topics</div><div><li>哈希表</li><li>字符串</li><li>排序</li></div></div>\n<div><li>👍 401</li><li>👎 0</li></div>