class Solution(object):
    def lengthOfLongestSubstring(self, s):
        d = ""
        f = ""
        for i in range(len(s)):
            if s[i] not in f:
                f += s[i]
            else:
                if len(d) < len(f):
                    d = f
                f = f[f.index(s[i])+1::] + s[i]
              
        return max(len(d), len(f))

 

 

相关文章:

  • 2022-01-10
  • 2021-05-17
  • 2022-02-05
  • 2021-12-25
  • 2021-10-31
猜你喜欢
  • 2021-09-05
  • 2021-11-10
  • 2021-10-03
  • 2021-06-04
  • 2021-09-12
  • 2021-12-23
  • 2021-09-14
  • 2021-11-20
相关资源
相似解决方案