Search⌘ K
AI Features

Find Longest Special Substring That Occurs Thrice I

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

We'll cover the following...

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:

  • ...