Longest Repeating Character Replacement

Medium
StringSliding WindowHash TableMetaAmazon
Given an uppercase string and integer k, you may replace at most k characters. Print the length of the longest substring that can be made of one repeated character. Input format: - First line: s - Second line: k

Constraints

1 <= s.length <= 10^5
0 <= k <= s.length
s contains uppercase English letters.

Sample tests

Sample 1

Sample 2

Sign in to submit