Longest Repeating Character Replacement
You may change at most k characters of s to any other uppercase letter. After the changes, find the longest contiguous piece made of one repeated letter. Return the greatest length you can reach.
Example 1
s "ABAB"
k 2
returns 4
Change both A to B (or the other way) to get length 4.
Example 2
s "AABABBA"
k 1
returns 4
Changing one letter gives a run of 4.
Constraints
1 <= len(s) <= 500 <= k <= len(s)- Uppercase letters only
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.