美文网首页
找最长不重复子串

找最长不重复子串

作者: Jlan | 来源:发表于2018-08-29 14:05 被阅读10次
In [53]: def find(string=s):
    ...:     flag=True
    ...:     print(string)
    ...:     tmp=string[0]
    ...:     for inx, s in enumerate(string[1:]):
    ...:         print(tmp, s)
    ...:         if s not in tmp:
    ...:             tmp+=s
    ...:         else:
    ...:             results.append(tmp)
    ...:             start = string.index(s)
    ...:             print(start)
    ...:             flag = False
    ...:             break
    ...:     if not flag:
    ...:         find(string=string[start+1:])
    ...:     else:
    ...:         results.append(tmp)

相关文章

网友评论

      本文标题:找最长不重复子串

      本文链接:https://www.haomeiwen.com/subject/rjohwftx.html