Count Substrings With K-Frequency Characters I | Java | 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int numberOfSubstrings(String s, int k) {\n       int l = 0 ;\n       int ans = 0 ;\n       int r = 0 ;\n       int n = s.length();\n\n       int freq[] = new int[26];\n\n       while(l <= r && r < s.length()){\n            freq[s.charAt(r) - \'a\']++;\n             \n            while(freq[s.charAt(r) - \'a\'] == k){\n                ans+= (s.length()-r);\n                \n                 freq[s.charAt(l) - \'a\']--;\n                l++;\n               \n            }\n            r++;\n            \n       } \n\n       return ans;\n    }\n}\n```
['Hash Table', 'Sliding Window', 'Java']