mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
23 lines
1.0 KiB
HTML
23 lines
1.0 KiB
HTML
<p>Given two strings <code>s</code> and <code>t</code>, return <code>true</code> <em>if</em> <code>t</code> <em>is an anagram of</em> <code>s</code><em>, and</em> <code>false</code> <em>otherwise</em>.</p>
|
|
|
|
<p>An <strong>Anagram</strong> is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
<pre><strong>Input:</strong> s = "anagram", t = "nagaram"
|
|
<strong>Output:</strong> true
|
|
</pre><p><strong class="example">Example 2:</strong></p>
|
|
<pre><strong>Input:</strong> s = "rat", t = "car"
|
|
<strong>Output:</strong> false
|
|
</pre>
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= s.length, t.length <= 5 * 10<sup>4</sup></code></li>
|
|
<li><code>s</code> and <code>t</code> consist of lowercase English letters.</li>
|
|
</ul>
|
|
|
|
<p> </p>
|
|
<p><strong>Follow up:</strong> What if the inputs contain Unicode characters? How would you adapt your solution to such a case?</p>
|