Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Longest Repeating Character Replacement

Medium Strings

Given a string s of uppercase letters and an integer k, you may change at most k characters to any other letter. Print the length of the longest substring containing the same letter after the changes.

Constraints

1 <= len(s) <= 10^5 0 <= k <= len(s)

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.