← Questions

Longest repeating character replacement

0
MicrosoftCodingLast asked Sep 2026

Given a string of uppercase letters and an integer k, you may change at most k characters to any other letter. Return the length of the longest substring that can be made of one repeated letter. Explain the sliding window that tracks the most frequent letter in the window.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding