- 给定一个字符串,请你找出其中不含有重复字符的最长子串的长度。
int judge(char *s,int start,int end){
for(int i=start;i<end;i++){
if(s[i] == s[end]) return true;
}
return false;
}
int lengthOfLongestSubstring(char * s){
int len=strlen(s);
if(len==0) return 0;
int i=0,j=1;
int count=0,max=1;
int index;
while(j<len){
index=judge(s,i,j);
if(index){
i++;
}
else{
count=j-i+1;
j++;
}
if(count>max) max=count;
}
return max;
}