Longest Repeating Character Replacement
Medium
LC #424
stringhash mapvariable windowNot attempted yet
s contains only uppercase English letters. You may
change at most k characters, each to any
uppercase letter.
Return the length of the longest substring made of a single repeated letter that you can end up with.
Example 1
Input: s = "ABAB", k = 2
Output: 4
Change both A's to B (or both B's to A).
Example 2
Input: s = "AABABBA", k = 1
Output: 4
Change the middle "A" of "BABB" to get "BBBB".
Example 3
Input: s = "ABCDE", k = 1
Output: 2
Constraints
- 1 ≤ len(s) ≤ 10^5
- 0 ≤ k ≤ len(s)