题目

字符串轮转。给定两个字符串s1s2,请编写代码检查s2是否为s1旋转而成(比如,waterbottleerbottlewat旋转后的字符串)。

image.png

思路

image.png

  1. class Solution:
  2. def isFlipedString(self, s1: str, s2: str) -> bool:
  3. return len(s1) == len(s2) and (s2 + s2).find(s1) != -1