Longest Consecutive Duplicate String
Given a lowercase alphabet string s
, return the length of the longest substring with same characters.
Constraints
0 ≤ n ≤ 100,000
wheren
is the length ofs
https://binarysearch.com/problems/Longest-Consecutive-Duplicate-String
Examples
Example 1
Input
- s =
aaabbb
Output
- answer =
3
Example 2
Input
- s =
abbbba
Output
- answer =
4
Explanation
The longest substring is "bbbb"
.
Leave a comment