Easy · Strings
Rotate string
Given two ASCII strings s and goal, return true if goal can be obtained from s by some number of rotations (each moves the first character of s to the end), otherwise false.
Examples
Example 1
{
"s": "abcde",
"goal": "cdeab"
}Output: true
Example 2
{
"s": "abcde",
"goal": "abced"
}Output: false
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.