3325. Count Substrings With K-Frequency Characters I
IntuitionOnce we are confirmed that a character repeats k times, we no longer need to keep traversing through the array.Code
# Intuition
Once we are confirmed that a character repeats k times, we no longer need to keep traversing through the array.

# Code
```python3 []
class Solution:
    def numberOfSubstrings(self, s: str, k: int) -> int:
        ans = 0
        for i in range(0, len(s)):
            freq = [0]*26
            for j in range(i, len(s)):
                freq[ord(s[j])-97]+=1
                if max(freq)>=k:
                    ans+=1
                    break
            ans += len(s) -j -1
        return ans


        
        
```
['Python3']