找最长不重复子串

2018-08-29  本文已影响10人  Jlan
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)
上一篇 下一篇

猜你喜欢

热点阅读