Longest Substring with At Least K Repeating Characters
https://leetcode.com/contest/leetcode-weekly-contest-3/problems/longest-substring-with-at-least-k-repeating-characters/
from collections import Counter
class Solution:
def longestSubstring(self, s: str, k: int) -> int:
if s =="":
return 0
c = Counter(s)
small = ""
val = min([val for val in c.values()])
for key,v in c.items():
if v == val:
small = key
break
if c.get(small) >= k:
return len(s)
return max([self.longestSubstring(t,k) for t in s.split(small)])
Last updated