|
| 1 | +<h2><a href="https://leetcode.com/problems/rotate-string">Rotate String</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><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> |
| 2 | + |
| 3 | +<p>A <strong>shift</strong> on <code>s</code> consists of moving the leftmost character of <code>s</code> to the rightmost position.</p> |
| 4 | + |
| 5 | +<ul> |
| 6 | + <li>For example, if <code>s = "abcde"</code>, then it will be <code>"bcdea"</code> after one shift.</li> |
| 7 | +</ul> |
| 8 | + |
| 9 | +<p> </p> |
| 10 | +<p><strong class="example">Example 1:</strong></p> |
| 11 | +<pre><strong>Input:</strong> s = "abcde", goal = "cdeab" |
| 12 | +<strong>Output:</strong> true |
| 13 | +</pre><p><strong class="example">Example 2:</strong></p> |
| 14 | +<pre><strong>Input:</strong> s = "abcde", goal = "abced" |
| 15 | +<strong>Output:</strong> false |
| 16 | +</pre> |
| 17 | +<p> </p> |
| 18 | +<p><strong>Constraints:</strong></p> |
| 19 | + |
| 20 | +<ul> |
| 21 | + <li><code>1 <= s.length, goal.length <= 100</code></li> |
| 22 | + <li><code>s</code> and <code>goal</code> consist of lowercase English letters.</li> |
| 23 | +</ul> |
0 commit comments