Tuesday, September 18, 2018

[LeetCode]Fruit Into Baskets


这道题本质上和Longest Substring with At Most Two Distinct Chars是一模一样的。我们用双指针sliding window即可解决。时间复杂度O(N),代码如下:


No comments:

Post a Comment