标签:nbsp 最长子串 code ges length int return char word
class Solution { public: int lengthOfLongestSubstring(string s) { int res=0,rul=1; map <char, int> word; for(int i=1;i<=s.length();++i){ if(word[s[i-1]]>=rul){ rul=word[s[i-1]]+1; word[s[i-1]]=i; }else{ word[s[i-1]]=i; res = max(res,i-rul+1); } } return res; } };
标签:nbsp 最长子串 code ges length int return char word
原文地址:https://www.cnblogs.com/cattree/p/13019149.html