Tap here to switch tabs
Problem
Submissions

Problem: Longest Substring of One Repeating Character

Try to solve the Longest Substring of One Repeating Character problem.

Statement

You are given a 00 indexed string s. You are also given a string queryCharacters of length k and an integer array queryIndices of length k, which describe k queries.

For each query ii from 00 to k−1k - 1:

  1. The character at index queryIndices[i] in s is replaced by queryCharacters[i].

  2. Compute the length of the longest substring of s that consists of a single repeating character.

Return an integer array of length k, where the value at index ii is the length of the longest substring consisting of one repeating character after applying the iextthi^{ ext{th}} query.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase English letters.

  • k == queryCharacters.length == queryIndices.length

  • 1≤1 \leq k ≤105\leq 10^5

  • queryCharacters consists of lowercase English letters.

  • 0≤0 \leq queryIndices[i] << s.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Substring of One Repeating Character

Try to solve the Longest Substring of One Repeating Character problem.

Statement

You are given a 00 indexed string s. You are also given a string queryCharacters of length k and an integer array queryIndices of length k, which describe k queries.

For each query ii from 00 to k−1k - 1:

  1. The character at index queryIndices[i] in s is replaced by queryCharacters[i].

  2. Compute the length of the longest substring of s that consists of a single repeating character.

Return an integer array of length k, where the value at index ii is the length of the longest substring consisting of one repeating character after applying the iextthi^{ ext{th}} query.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase English letters.

  • k == queryCharacters.length == queryIndices.length

  • 1≤1 \leq k ≤105\leq 10^5

  • queryCharacters consists of lowercase English letters.

  • 0≤0 \leq queryIndices[i] << s.length