TC : O(n), SC : O(26)
\n\n\n# Approach\n Describe your approach to solving the problem. \nTwo pointer approach (Sliding Window)\n\nTC : O(2n) ~ (n)\nSC : O(26) ~ O(1)\n\n\n\n# Code\n
\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTwo pointer approach (Sliding Window)\n\nTC : O(2n) ~ (n)\nSC : O(26) ~ O(1)\n\n\n\n# Code\n```python3 []\nclass Solution:\n    def numberOfSubstrings(self, s: str, k: int) -> int:\n        \n        freq = [0] * 26\n        low = 0\n        count = 0\n        n = len(s)\n        \n        for high in range(n):\n            \n            index = ord(s[high]) - ord(\'a\')\n            freq[index] += 1\n            \n            \n            while freq[index] >= k:\n                \n                count += n - high\n                \n                char = s[low]\n                char_index = ord(char) - ord(\'a\')\n                low += 1\n            \n                freq[char_index] -= 1\n                \n        return count\n        \n```
['Python3']