今天做了一道算法题
https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/
我的实现是暴力算法,思路比较简单,O(n2)算法复杂度。我看leetcode里面的讨论,这个思路不错,是O(n)算法复杂度。
https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/
他的代码很清晰,采用递归:找到第一个出现次数不到k次的字符,将字符串分成两半,然后对两半分别递归得到结果。
来源:https://blog.csdn.net/tassardge/article/details/101119102