Class Solution
-
- All Implemented Interfaces:
public final class Solution
3090 - Maximum Length Substring With Two Occurrences\.
Easy
Given a string
s
, return the maximum length of a substring such that it contains at most two occurrences of each character.Example 1:
Input: s = "bcbbbcba"
Output: 4
Explanation:
The following substring has a length of 4 and contains at most two occurrences of each character: <code>"bcbb<ins>bcba</ins>"</code>.
Example 2:
Input: s = "aaaa"
Output: 2
Explanation:
The following substring has a length of 2 and contains at most two occurrences of each character: <code>"<ins>aa</ins>aa"</code>.
Constraints:
2 <= s.length <= 100
s
consists only of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final Integer
maximumLengthSubstring(String s)
-
-
Method Detail
-
maximumLengthSubstring
final Integer maximumLengthSubstring(String s)
-
-
-
-