美文网首页
[LeetCode 159] Longest Substring

[LeetCode 159] Longest Substring

作者: 灰睛眼蓝 | 来源:发表于2019-08-02 16:01 被阅读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一样

相关文章

网友评论

      本文标题:[LeetCode 159] Longest Substring

      本文链接:https://www.haomeiwen.com/subject/xwwldctx.html