1 Star 3 Fork 5

刘炜/python LeetCode

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1387字符串轮转.py 535 Bytes
一键复制 编辑 原始数据 按行查看 历史
刘炜 提交于 2020-03-08 22:24 +08:00 . 双指针
class Solution:
def isFlipedString(self, s1: str, s2: str) -> bool:
if len(s1) != len(s2): return False
if s1 == s2: return True
s1 += s1
i = 0
j = 0
while(i < len(s1)):
if s1[i] == s2[j]:
if j == len(s2) - 1:
return True
i += 1
j += 1
elif s1[i] != s2[j]:
if i > len(s1) - len(s2):
break
i += 1
j = 0
return False
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/new_way/python-LeetCode.git
git@gitee.com:new_way/python-LeetCode.git
new_way
python-LeetCode
python LeetCode
master

搜索帮助