Tap here to switch tabs
Problem
Submissions

Problem: Find Longest Special Substring That Occurs Thrice I

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

Statement

Given a string s, a substring is called special if it is made up of only one repeated character.

Return the maximum possible length of a special substring that appears in s at least three times. If no special substring occurs at least three times, return -1.

Note: Occurrences are counted by substring positions in s, and they may overlap.

Constraints:

  • 3≤3 \leq s.length ≤50\leq 50

  • s consists of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Longest Special Substring That Occurs Thrice I

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

Statement

Given a string s, a substring is called special if it is made up of only one repeated character.

Return the maximum possible length of a special substring that appears in s at least three times. If no special substring occurs at least three times, return -1.

Note: Occurrences are counted by substring positions in s, and they may overlap.

Constraints:

  • 3≤3 \leq s.length ≤50\leq 50

  • s consists of only lowercase English letters.