这是程序员面试金典里面的一个题目。判断B是否是A旋转得到的,只要判断B是否是A+A的字串即可。
class Solution(object):
def rotateString(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
"""
return len(A)==len(B) and B in A+A
这是程序员面试金典里面的一个题目。判断B是否是A旋转得到的,只要判断B是否是A+A的字串即可。
class Solution(object):
def rotateString(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
"""
return len(A)==len(B) and B in A+A
转载于:https://www.cnblogs.com/learning-c/p/9280538.html