Easy solution using hashtable || GOLANG || CPP
Intuition\nThe problem requires counting the number of substrings where each character appears at least k times. We iterate over each starting index of the subs
# Intuition\nThe problem requires counting the number of substrings where each character appears at least k times. We iterate over each starting index of the substring, expanding from that point and using an array to keep track of character counts. Once a substring meets the condition, all following substrings starting from this position will also meet it, allowing us to increment the count.\n\n# Approach\n1. Loop through each starting index: For each starting point i, use another loop to expand the substring from i to n.\n2. Track Character Counts: Use an array arr to store the frequency of each character as the substring grows.\n3. Check Condition: For each substring, check if any character reaches k occurrences:\n* If so, mark found to 1, indicating that all further substrings starting at i will meet the requirement.\n* Increment ans to count valid substrings.\n\n# Complexity\n- Time complexity:\nO(n^2)\n\n- Space complexity:\nO(1)\n\n# Code\n```golang []\nfunc numberOfSubstrings(s string, k int) int {\n\n    n := len(s);\n    ans := 0;\n    for i := 0 ; i < n ; i++ {\n        var arr[26] int;\n        found := 0;\n        for j := i ; j < n ; j++ {\n            if found == 1 {\n                ans++;\n            } else {\n                if arr[s[j] - \'a\'] == k-1 {\n                    ans++;\n                    found = 1;\n                }\n                arr[s[j] - \'a\']++;\n            }\n        }\n    }\n    return ans;\n}\n```\n```cpp []\nclass Solution {\npublic:\n    int numberOfSubstrings(string s, int k) {\n        int n = s.size();\n        int ans = 0;\n        for(int i = 0 ; i < n ; i++) {\n            vector<int>v(26,0);\n            int found = 0;\n            for(int j = i ; j < n ; j++) {\n                if(found) {\n                    ans++;\n                } else {\n                    if(v[s[j] - \'a\'] == k-1) {\n                        found = 1; \n                        ans++;\n                    }\n                    v[s[j] - \'a\']++;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```\n\n
['Hash Table', 'C++', 'Go']