Easy to understand Java Solution | O(n)
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 f[]=new int[26];\n        int i=0,j=0,n=s.length();\n        int c=0;\n        while(j<n){\n            char ch=s.charAt(j);\n            f[ch-\'a\']++;\n            while(f[ch-\'a\']==k){\n                f[s.charAt(i)-\'a\']--;\n                i++;\n                c+=n-j;\n            }\n            j++;\n        }\n        return c;\n    }\n}\n```
['Sliding Window', 'Java']