标签:滑动 bre cab 16px pre emc 答案 bcb ++
1 int lengthOfLongestSubstring(string s) 2 { 3 if(s.size() == 0) 4 return 0; 5 if(s.size() == 1) 6 return 1; 7 8 int start = 0,end = 0; 9 int res = 0, length = 0; 10 int sSize = s.size(); 11 12 while(end < sSize) 13 { 14 char temChar = s[end]; 15 for(int index = start; index < end; index++) 16 { 17 if(temChar == s[index]) 18 { 19 start = index+1; 20 length = end-start; 21 break; 22 } 23 } 24 25 end++; 26 length++; 27 res = max(res, length); 28 } 29 return res; 30 }
标签:滑动 bre cab 16px pre emc 答案 bcb ++
原文地址:https://www.cnblogs.com/ZhengLijie/p/12820867.html