[LeetCode 159] Longest Substring

2019-08-02  本文已影响0人  灰睛眼蓝

Given a string s , find the length of the longest substring t that contains at most 2 distinct characters.

Example 1:

Input: "eceba"
Output: 3
Explanation: t is "ece" which its length is 3.

Example 2:

Input: "ccaabbb"
Output: 5
Explanation: t is "aabbb" which its length is 5.

Solution 与## 340一样

上一篇 下一篇

猜你喜欢

热点阅读