Longest Repeating Character Replacement
Medium
Topics
Given a string s of uppercase English letters and an integer k, you may replace at most k characters with any uppercase letter. Return the length of the longest substring containing a single repeated letter you can obtain.
Example 1
Input: s = "ABAB", k = 2 Output: 4
Example 2
Input: s = "AABABBA", k = 1 Output: 4
Constraints
- 1 <= s.length <= 10^5
- s consists of uppercase English letters.
- 0 <= k <= s.length
Run ⌘' · Submit ⌘⏎