Practice Longest Substring of One Repeating Character
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Longest Substring of One Repeating Character
Problem Statement
You are given a 0-indexed string s. You are also given a 0-indexed string queryCharacters of length k and a 0-indexed array of integer indices queryIndices of length k, both of which are used to describe k queries. The ith query updates the character in s at index queryIndices[i] to the character queryCharacters[i]. Return an array lengths of length k where lengths[i] is the length of the longest substring of s consisting of only one repeating character after the ith query is performed.
Source: Longest Substring of One Repeating Character on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "babacc", queryCharacters = "bcb", queryIndices = [1,3,3]
[3,3,4]
# Example 2
s = "abyzz", queryCharacters = "aa", queryIndices = [2,1]
[2,3]
Constraints
Related LeetCode Problems
Practice more problems similar to Longest Substring of One Repeating Character.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.