Medium
Longest Repeating Character Replacement
Medium
67 submissions
25 coins
+100 XP
Hash Table
Sliding Window
String
Problem Description
You may change at most `k` characters of the uppercase string `s` to any other uppercase letter. Return the length of the longest substring that can be made of a single repeated letter.
**Example 1:**
```
Input: s = "ABAB", k = 2
Output: 4
```
**Example 2:**
```
Input: s = "AABABBA", k = 1
Output: 4
```
**Example 3:**
```
Input: s = "AAAA", k = 0
Output: 4
```
Constraints
- `1 <= s.length <= 10^5`
- `0 <= k <= s.length`
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share