2730. Find the Longest Semi-Repetitive Substring
You are given a 0-indexed string
s
that consists of digits from0
to9
.A string
t
is called a semi-repetitive if there is at most one consecutive pair of the same digits insidet
.Return the length of the longest semi-repetitive substring inside
s
.A substring is a contiguous non-empty sequence of characters within a string.
1 | class Solution { |