395. Longest Substring with At L

2016-12-24  本文已影响0人  阿团相信梦想都能实现
class Solution(object):
    def longestSubstring(self, s, k):
        """
        :type s: str
        :type k: int
        :rtype: int
        """
        for c in set(s):
            if s.count(c)<k:
                return max(self.longestSubstring(t,k) for t in s.split(c))
        return len(s)
        
上一篇 下一篇

猜你喜欢

热点阅读