Longest Repeating Character Replacement
Problem
Given a string of uppercase letters and an integer k, find the length of the longest substring you can make consist of a single repeated letter by replacing at most k characters.
Input / Output
- Input: string
s, integerk. - Output: the length of the longest achievable single-letter substring.
Constraints
- 1 ≤ |s| ≤ 10^5; k ≥ 0.
Example
- s = "AABABBA", k = 1 → 4.
- s = "ABAB", k = 2 → 4.
added …