class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
num = 0
l = len(s)
for i in range(l):
s1 = ""
s1 = s[i]
j = 1
now_num = 1
while i + j < l:
if s[i+j] in s1:
break
else:
s1 = s1 + s[i+j]
j = j + 1
now_num = now_num + 1
if now_num > num:
num = now_num
return num
【leetcode 刷题】3、无重复字符的最长子串
最新推荐文章于 2026-01-09 18:00:00 发布
862

被折叠的 条评论
为什么被折叠?



