Coding Challenge

Longest Repeating Character Replacement

Medium
stringsliding-window

Maximize repeating characters by replacing at most k characters.

Return the length of the longest substring you can make contain the same character after replacing at most k characters.

Examples

Input: s = "ABAB", k = 2

Output: 4

Constraints

  • String contains uppercase English letters

Preparing your coding workspace...