fixed length sliding window applied 26 times !!!
Intuition\n Describe your first thoughts on how to solve this problem. if are not able to understand the code, read the hints provided once (one hint i have alr
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->if are not able to understand the code, read the hints provided once (one hint i have already provided in the title ;) ). Maybe you will be able to write the code on your own after reading the hints, if not then you can refer to my code.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(26 * 26 * n) ,i.e O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(26) , i.e constant\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\nprivate:\n    bool isAllCharFreqk(vector<int>& charFreq, int k) {\n        bool flag = true;\n\n        for(int i = 0; i < 26; i++) {\n            if(charFreq[i] == 0) continue;\n            flag &= (charFreq[i] == k);\n        }\n\n        return flag;\n    }\npublic:\n    int countCompleteSubstrings(string word, int k) {\n        \n        int n = word.size(), cnt = 0;\n\n        int numOfUniqCharInSubStr = 26;\n\n        for(int numOfUniqCharInSubStr = 1; numOfUniqCharInSubStr <= 26; numOfUniqCharInSubStr++) {\n\n            if((k * numOfUniqCharInSubStr) > n) continue;\n\n            int i = 0, j = 0, sizeOfWindow = k*numOfUniqCharInSubStr;\n            vector<int> charFreq(26, 0);\n            int nextInd = -1; \n            \n            while(j < n) {\n                charFreq[word[j] - \'a\']++;\n                if(j > i && abs(word[j] - word[j-1]) > 2) nextInd = j;\n\n                if(j - i + 1 == sizeOfWindow) {\n                    bool flag = isAllCharFreqk(charFreq, k);\n                    if(nextInd == -1) {\n                        if(flag){\n                            cnt++;\n                        } \n                        charFreq[word[i] - \'a\']--;\n                        i++;\n                    }\n                    else {\n                        while(i != nextInd) {\n                            charFreq[word[i] - \'a\']--;\n                            i++;\n                        }\n                        nextInd = -1;\n                    }\n                }\n\n                j++;\n            }\n        }\n\n        return cnt;\n    }\n};\n```
['Hash Table', 'Sliding Window', 'C++']