题目:
题解:
class Solution:def characterReplacement(self, s: str, k: int) -> int:num = [0] * 26n = len(s)maxn = left = right = 0while right < n:num[ord(s[right]) - ord("A")] += 1maxn = max(maxn, num[ord(s[right]) - ord("A")])if right - left + 1 - maxn > k:num[ord(s[left]) - ord("A")] -= 1left += 1right += 1return right - left