Build the PrimitiveMedium
Longest Repeating Character Replacement
Write `character_replacement(s, k)` returning the length of the longest substring that can be made of one repeated character by replacing at most `k` characters.
character_replacement("AABABBA", 1) -> 4 ("AABA" -> "AAAA")
A window is valid when `window_length - count_of_the_most_common_character <= k`. The subtle part: that most-common count can be left stale when the window shrinks. It never produces a wrong answer, because a smaller window can only matter if it later beats the best — and to do that it must first raise the count again. Be ready to say that out loud.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.