Back to problems

Longest Repeating Character Replacement

Algorithm · ByteDance · Medium

You receive a string s made up exclusively of uppercase English characters. You may change any character in this string into any other letter, using no more than k such changes. Determine the greatest possible length of a contiguous segment that can consist of one repeated letter after at most k replacements. Input: An uppercase-letter string s whose length is in [1, 10^5]. An integer k in the range [0, s ]. Output: The largest achievable length of a substring formed from…

Checking your access…