https://leetcode.cn/problems/longest-repeating-character-replacement/
class Solution {
public:
int characterReplacement(string s, int k) {
if(s.empty()){
return 0;
}
vector<int> v(26);
// 滑动窗口初始化,右边界每一步都在变化,直到边界
int left = 0, right = 0, maxx = 0;
for(right = 0; right < s.length(); right++){
int temp = s[right] - 'A';
v[temp]++;
maxx = max(v[temp], maxx);
if(right - left + 1 > maxx + k){
v[s[left] - 'A']--;
left++;
}
}
// 返回滑动窗口的大小
return s.length() - left;
}
};
标签:maxx,right,窗口,temp,int,滑动,指针,left
From: https://www.cnblogs.com/changebaobao/p/16719417.html