- 双指针
class Solution {
public:
int longestContinuousSubstring(string s) {
int res = 0;
for(int i = 0; i < s.size(); i++){
int j = i + 1;
while(j < s.size() && s[j] == s[j - 1] + 1) j++;
res = max(res,j - i);
i = j - 1;
}
return res;
}
};
标签:int,res,字母,2414,字符串,LeetCode,size
From: https://www.cnblogs.com/Sheldon2/p/16732418.html