标签:mic string http size longest png 重复 star 图片
class Solution {
public:
int lengthOfLongestSubstring(string s) {
int len = s.size();
map<char, int> myMap;
map<char, int>::iterator itor;
int start = 0;
int maxNum = 0;
for (int i = 0; i < len; i++)
{
itor = myMap.find(s[i]);
if (itor != myMap.end())
{
start = max(itor->second, start);
}
myMap[s[i]] = i + 1;
maxNum = max(maxNum, i - start + 1);
}
return maxNum;
}
};
标签:mic string http size longest png 重复 star 图片
原文地址:https://www.cnblogs.com/woodjay/p/12375369.html