Friday, October 27, 2017

[LeetCode]Longest Substring with At Most K Distinct Characters

Longest Substring with at Most Two Distinct Character的题目是一样的。区别就是判断的时候从2个不同char变为k个不同的char即可。时间复杂度O(n),空间复杂度O(n),代码如下:


No comments:

Post a Comment