We’re preparing your current view and syncing the latest data.
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. For example, if s = 'abcde', then it will be 'bcdea' after one shift. Determine if s can be rotated any number of times to become goal.
Two strings s and goal.
Boolean: true if s can be rotated to become goal, else false.
1 <= s.length, goal.length <= 1000; s and goal consist of lowercase English letters.
Example 1
Input
s = "abcde", goal = "cdeab"
Output
true
Explanation
Rotate 'abcde' twice results in 'cdeab'.
Example 2
Input
s = "abcde", goal = "abced"
Output
false
Explanation
'abced' is not a rotation of 'abcde'.