1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-25 17:50:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/有效的字母异位词 [valid-anagram].html
2022-03-29 12:43:11 +08:00

32 lines
1.1 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定两个字符串 <code><em>s</em></code><code><em>t</em></code> ,编写一个函数来判断 <code><em>t</em></code> 是否是 <code><em>s</em></code> 的字母异位词。</p>
<p><strong>注意:</strong>若 <code><em>s</em></code><code><em>t</em></code><em> </em>中每个字符出现的次数都相同,则称 <code><em>s</em></code><code><em>t</em></code><em> </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>