今際の国の呵呵君
Friday, October 27, 2017
[LeetCode]Longest Substring with At Most Two Distinct Characters
和
Longest Substring without Repeating Character
是非常类似的题目,区别只是条件稍有不同,本质的做法都是一样的。可以用sliding window解,时间复杂度O(n),空间复杂度O(n),代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment