class Solution {
public:
int lengthOfLongestSubstring(string s) {
int start = 0;
int end = 0;
int len = 0;
int res = 0;
while(end < s.size()){
char tmp = s[end];
for(int index = start;index < end;index++){
if(s[index] == tmp){
start = index+1;
len = end - start;
break;
}
}
end++;
len++;
res = max(res,len);
}
return res;
}
};
09-18
801
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-04
753
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交