796 Rotate String
We are given two strings,A
andB
.
A_shift onA
_consists of taking stringA
and moving the leftmost character to the rightmost position. For example, ifA = 'abcde'
, then it will be'bcdea'
after one shift onA
. ReturnTrue
if and only ifA
can becomeB
after some number of shifts onA
.
Note:
A
andB
will have length at most100
.
这题在cc189见过,如果是合法的rotattion的话,那个把原来的string连起来,那个rotate了的string会是那个的substring。例如:abcdeabcde里会有cdeab,如果不是合法的就不会是substring
Last updated