Tap here to switch tabs
Problem
Submissions

Problem: Find Longest Special Substring That Occurs Thrice II

med
30 min
Try to solve the Find Longest Special Substring That Occurs Thrice II problem.

Statement

You are given a string s that contains only lowercase English letters.

A substring of s is called special if it is composed of only a single distinct character.

Return the length of the longest special substring of s that appears at least 33 times, or −1-1 if no such substring exists.

Constraints:

  • 3≤3 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s consists of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Longest Special Substring That Occurs Thrice II

med
30 min
Try to solve the Find Longest Special Substring That Occurs Thrice II problem.

Statement

You are given a string s that contains only lowercase English letters.

A substring of s is called special if it is composed of only a single distinct character.

Return the length of the longest special substring of s that appears at least 33 times, or −1-1 if no such substring exists.

Constraints:

  • 3≤3 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s consists of only lowercase English letters.