Longest Repeat After Replacements
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
Given a string of capital letters and a number k, you may change up to k letters to any other letter. Find the length of the longest stretch of a single repeated letter you could make, and explain when your window must shrink.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.