Warm-ups · 21 of 24
Check if two strings are rotations
Return true if goal can be made by moving some characters from the front of s to its end.
Examples
Input s = "abcde", goal = "cdeab"
Output true
Move "ab" to the end.
Input s = "abcde", goal = "abced"
Output false
📘 New to this? Building a new string or array as the answer explains the idea in a few minutes.
Solved it? The same idea on LeetCode: try it there ↗