Longest Repeating Character Replacement

You are given a string s and an integer k. You may change up to k characters in the string to any other uppercase English letters to achieve the longest possible substring with all identical letters. Return the length of the longest such substring.

Constraints

  • 1 <= s.length <= 10^5
  • s consists of only uppercase English letters.
  • 0 <= k <= s.length
Saving… · 2 lines
class Solution:
def longestRepeatingCharacterReplacement(self, s: str, k: int) -> int:
Console

Click Run to execute sample tests.