424. Longest Repeating Character Replacement

Practice Longest Repeating Character Replacement for free on NudgeCode: Medium, Sliding Window pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

You may change at most k characters of s to any other uppercase letter. Return the length of the longest contiguous piece that can be made of a single repeated letter.

Example

s = "ABAB", k = 2     ->  4   (change both A's or both B's)
s = "AABABBA", k = 1  ->  4   (change the middle A: "AABBBBA")

Constraints