Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int:
- # count frequency of characters
- count = collections.Counter()
- # Check only for minSize
- for i in range(len(s) - minSize + 1):
- t = s[i : i+minSize]
- if len(set(t)) <= maxLetters:
- count[t] += 1
- return max(count.values()) if count else 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement