1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (English)/字符串轮转(English) [string-rotation-lcci].html

24 lines
952 B
HTML

<p>Given two strings, <code>s1</code>&nbsp;and <code>s2</code>, write code to check if <code>s2</code> is a rotation of <code>s1</code> (e.g.,&quot;waterbottle&quot; is a rotation of&quot;erbottlewat&quot;).&nbsp;Can you use&nbsp;only one call to the method that&nbsp;checks if one word is a substring of another?</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input: </strong>s1 = <span id="example-input-1-1">&quot;waterbottle&quot;</span>, s2 = <span id="example-input-1-2">&quot;</span>erbottlewat<span>&quot;</span>
<strong>Output: </strong><span id="example-output-1">True</span>
</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input: </strong>s1 = &quot;aa&quot;, s2 = &quot;aba&quot;
<strong>Output: </strong>False
</pre>
<p>&nbsp;</p>
<p><strong>Note:</strong></p>
<ol>
<li><code><font face="monospace">0 &lt;= s1.length, s2.length &lt;=&nbsp;</font>100000</code></li>
</ol>