18. Longest Repeating Character Replacement

s has uppercase letters. You may change at most k characters to any other uppercase letter. Return the length of the longest substring that can be made of one repeated letter.

Example 1

Input: s = "AABABBA", k = 1
Output: 4

Example 2

Input: s = "ABAB", k = 2
Output: 4
Hint 1

A window is valid when (window length − count of its most frequent letter) ≤ k.

Sliding WindowString