FunctionRacerProblemsRace

Rotate String

EasyStringsPython, JavaScript, TypeScript, Java, C++

One move takes the first character of s and puts it at the end. Return True if s can become goal after some number of moves (zero moves allowed), otherwise False.

Example 1

s "abcde"
goal "cdeab"
returns true

Two moves turn abcde into cdeab.

Example 2

s "abcde"
goal "abced"
returns false

No rotation matches.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems