首页 > 其他 > 详细

796. Rotate String

时间:2018-07-08 17:10:44      阅读:206      评论:0      收藏:0      [点我收藏+]

这是程序员面试金典里面的一个题目。判断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
        

 

796. Rotate String

原文:https://www.cnblogs.com/learning-c/p/9280538.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!