Rotate String
Think before you code.Decide whether one string becomes another after some number of left shifts.
Rotate String
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.
Example 1
Input : s = "abcde", goal = "cdeab"
Output : true
Explanation :
After performing 2 shifts we can achieve the goal string from string s. After the first shift the string s is => bcdea. After the second shift the string s is => cdeab.
Example 2
Input : s = "abcde", goal = "adeac"
Output : false
Explanation :
Any number of shift operations cannot convert string s to string goal.
Example 3
Input : s = "abcde", goal = "abcde"
Output : true
Constraints
1 <= s.length <= 1001 <= goal.length <= 100s and goal consist of only lowercase English letters.