Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 1.17 KB

File metadata and controls

57 lines (35 loc) · 1.17 KB

中文文档

Description

Given a string s, return the length of the longest substring that contains at most two distinct characters.

 

Example 1:

Input: s = "eceba"
Output: 3
Explanation: The substring is "ece" which its length is 3.

Example 2:

Input: s = "ccaabbb"
Output: 5
Explanation: The substring is "aabbb" which its length is 5.

 

Constraints:

  • 1 <= s.length <= 104
  • s consists of English letters.

Solutions

Python3

Java

...