Tap here to switch tabs
Problem
Submissions

Problem: Find the Longest Semi-Repetitive Substring

med
30 min
Try to solve the Find the Longest Semi-Repetitive Substring problem.

Statement

You are given a digit string s.

A string is called semi repetitive if there is at most one adjacent pair of identical digits within it.

Return the length of the longest semi repetitive substring found in s.

Constraints:

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

  • '0' ≤\leq s[i] ≤\leq '9'

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Longest Semi-Repetitive Substring

med
30 min
Try to solve the Find the Longest Semi-Repetitive Substring problem.

Statement

You are given a digit string s.

A string is called semi repetitive if there is at most one adjacent pair of identical digits within it.

Return the length of the longest semi repetitive substring found in s.

Constraints:

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

  • '0' ≤\leq s[i] ≤\leq '9'