mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
24 lines
998 B
HTML
24 lines
998 B
HTML
<p>Given two strings <code>s</code> and <code>goal</code>, return <code>true</code> <em>if and only if</em> <code>s</code> <em>can become</em> <code>goal</code> <em>after some number of <strong>shifts</strong> on</em> <code>s</code>.</p>
|
|
|
|
<p>A <strong>shift</strong> on <code>s</code> consists of moving the leftmost character of <code>s</code> to the rightmost position.</p>
|
|
|
|
<ul>
|
|
<li>For example, if <code>s = "abcde"</code>, then it will be <code>"bcdea"</code> after one shift.</li>
|
|
</ul>
|
|
|
|
<p> </p>
|
|
<p><strong>Example 1:</strong></p>
|
|
<pre><strong>Input:</strong> s = "abcde", goal = "cdeab"
|
|
<strong>Output:</strong> true
|
|
</pre><p><strong>Example 2:</strong></p>
|
|
<pre><strong>Input:</strong> s = "abcde", goal = "abced"
|
|
<strong>Output:</strong> false
|
|
</pre>
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= s.length, goal.length <= 100</code></li>
|
|
<li><code>s</code> and <code>goal</code> consist of lowercase English letters.</li>
|
|
</ul>
|