HashMap soln || O(n2) approach || Easy to understand
Complexity\n- Time complexity:\nO(n2)\n\n- Space complexity:\nO(n)\n\n# Code\njava []\nclass Solution {\n    public int numberOfSubstrings(String s, int k) {\n 
# Complexity\n- Time complexity:\nO(n2)\n\n- Space complexity:\nO(n)\n\n# Code\n```java []\nclass Solution {\n    public int numberOfSubstrings(String s, int k) {\n        int count = 0;\n        int n = s.length();\n\n        for(int i = 0; i < s.length(); i++){\n            HashMap<Character, Integer> map = new HashMap<>();\n            for(int j = i; j < s.length(); j++){\n                char ch = s.charAt(j);\n\n                map.put(ch, map.getOrDefault(ch, 0)+1);\n                if(map.get(ch) >= k){\n                    count += n-j;\n                    break;\n                }\n            }\n        }\n\n        return count;\n    }\n}\n```
['Java']