1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-03-14 16:22:24 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/字符串的排列 [permutation-in-string].html

30 lines
969 B
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>给你两个字符串&nbsp;<code>s1</code>&nbsp;&nbsp;<code>s2</code> ,写一个函数来判断 <code>s2</code> 是否包含 <code>s1</code><strong>&nbsp;</strong><span data-keyword="permutation-string">排列</span>。如果是,返回 <code>true</code> ;否则,返回 <code>false</code></p>
<p>换句话说,<code>s1</code> 的排列之一是 <code>s2</code><strong>子串</strong></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s1 = "ab" s2 = "eidbaooo"
<strong>输出:</strong>true
<strong>解释:</strong>s2 包含 s1 的排列之一 ("ba").
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s1= "ab" s2 = "eidboaoo"
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s1.length, s2.length &lt;= 10<sup>4</sup></code></li>
<li><code>s1</code><code>s2</code> 仅包含小写字母</li>
</ul>