1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/旋转字符串 [rotate-string].html

33 lines
984 B
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p>给定两个字符串, <code>s</code>&nbsp;&nbsp;<code>goal</code>。如果在若干次旋转操作之后,<code>s</code>&nbsp;能变成&nbsp;<code>goal</code>&nbsp;,那么返回&nbsp;<code>true</code>&nbsp;</p>
<p><code>s</code>&nbsp;<strong>旋转操作</strong> 就是将&nbsp;<code>s</code> 最左边的字符移动到最右边。&nbsp;</p>
<ul>
<li>例如, 若&nbsp;<code>s = 'abcde'</code>,在旋转一次之后结果就是<code>'bcdea'</code>&nbsp;</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong> s = "abcde", goal = "cdeab"
<strong>输出:</strong> true
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> s = "abcde", goal = "abced"
<strong>输出:</strong> false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length, goal.length &lt;= 100</code></li>
<li><code>s</code>&nbsp;&nbsp;<code>goal</code>&nbsp;由小写英文字母组成</li>
</ul>