Basic approach, Direct Way
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        HashMap<Character,Integer> map=new HashMap<>();\n        int count=0;\n        for(int i=0;i<s.length();i++)\n        {\n            map.put(s.charAt(i),map.getOrDefault(s.charAt(i),0)+1);\n            if(map.get(s.charAt(i))>=k)count++;\n            int max=Math.max(map.get(s.charAt(i)),0);\n            for(int j=i+1;j<s.length();j++)\n            {\n                char c=s.charAt(j);\n                map.put(c,map.getOrDefault(c,0)+1);\n                if(map.get(c)>=k || max>=k){count++;} //To see whether there is a character which is repeating atleast k times\n                max=Math.max(map.get(c),max);\n            }\n            map.clear();\n        }\n        return count;\n\n    }\n}\n```
['Hash Table', 'Java']