Practice Rotate String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the rightmost position.
Source: Rotate String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "abcde", goal = "cdeab"
Output
true
# Example 2
Input
s = "abcde", goal = "abced"
Output
false
Constraints
1 <= s.length, goal.length <= 100
s and goal consist of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Rotate String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.