243. Longest Repeating Character Replacement
Given a string `s` consisting of uppercase English letters and an integer `k`, you can choose any character in the string and change it to any other uppercase English letter at most `k` times. Return the length of the longest substring that contains only one repeating character after performing at most `k` replacements. For example, given s = "AABABBA" and k = 1, you can change one character. The longest substring of a single repeating character you can achieve is "AABAB**B**A" -> "AABABBA" -> change index 3 from 'B' to 'A' giving "AAAA" of length 4 (taking substring indices 0-3).
Examples
Input: ABAB 2
Output: 4
Explanation: Replace both 'B's with 'A' (or both 'A's with 'B') to get a string of 4 identical characters.
Constraints
- 1 <= s.length <= 10^5
- s consists of only uppercase English letters
- 0 <= k <= s.length
Run checks all cases above. Submit evaluates all test cases.