Easy straightforward approach
Intuition\nTo solve the problem of counting substrings that contain at least k occurrences of any character, I initially thought about iterating through all pos
# Intuition\nTo solve the problem of counting substrings that contain at least `k` occurrences of any character, I initially thought about iterating through all possible substrings of the given string `s`. For each substring, I could count the occurrences of each character and check if any of them met the requirement of at least `k` occurrences, Which is brute-force straightforward approach.\n\n# Approach\n- Start by initializing a counter `ans` to keep track of the number of valid substrings. Use a character count array `ct` of size 26 to count the occurrences of each character in the substring.\n\n- Iterate through each starting index `i` of the string `s`.For each starting index, iterate through the substring starting from `i` to the end of the string. Update the character count array for each character encountered.\n\n- Use a boolean flag `valid_sub` to indicate if a valid substring has been found. If the count of any character reaches `k`, set `valid_sub` to `True`.If `valid_sub` is `True`, increment the count of valid substrings `ans`.\n\n- After checking all possible substrings, return the total count of valid substrings.\n\n# Complexity\n- **Time Complexity**: `O(n^2)`, where `n` is the length of the string `s`, due to the nested loops iterating through each substring.\n\n- **Space Complexity**: `O(1)`, as the character count array has a fixed size of 26, regardless of the size of the input string.\n\n# Code\n```python3 []\nclass Solution:\n    def numberOfSubstrings(self, s: str, k: int) -> int:\n        ans=0\n        for i in range(len(s)):\n            ct=[0]*26\n            valid_sub=False\n            for j in range(i,len(s)):\n                ct[ord(s[j])-ord(\'a\')]+=1\n                if ct[ord(s[j])-ord(\'a\')]>=k:\n                    valid_sub=True\n                if valid_sub:\n                    ans+=1\n        return ans  \n```
['String', 'Sliding Window', 'Python3']