424. Longest Repeating Character Replacement
题目描述
Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repeating letters you can get after performing the above operations.
Note:
Both the string’s length and k will not exceed 104.
Example 1:
|
|
Example 2:
|
|
题目大意
替换字符串 s
中 k
个字符,使字符串拥有最长重复字符。
解题思路
滑动窗口
维护有效区间l...r
,使得区间内除重复字符以外的字符不大于k。
代码
|
|