Longest Repeating Character Replacement
Given a string s containing only uppercase English letters and an integer k, you may replace at most k characters with any uppercase English letter. Return…
Given a string `s` containing only uppercase English letters and an integer `k`, you may replace at most `k` characters with any uppercase English letter. Return the length of the longest contiguous substring that can be made of one repeated character.
- `1 <= s.length <= 10^5` - `s` contains only uppercase English letters. - `0 <= k <= s.length` - The interactive visualizer accepts at most 15 characters; longer valid inputs are execution-only.
Example 1: input s = "ABAB", k = 2; output 4. Replacing both A characters or both B characters makes the whole string uniform.
Example 2: input s = "AABABBA", k = 1; output 4. A length-four window such as "AABA" can be made uniform with one replacement.
Category: Sliding Window. Topic: sliding-window. Difficulty: Medium. Patterns: sliding-window, hashing.