C++ | Sliding Window
Code\n\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        int ans = 0;\n        unordered_map<char, int>
# Code\n```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        int ans = 0;\n        unordered_map<char, int> Map;\n        unordered_map<string, int> substrOccur;\n        for(int start = 0, end = 0; end < s.length(); end++) {\n            if(Map[s[end]]++ == 0) maxLetters--;\n            while(maxLetters < 0 || end - start + 1 > minSize) {\n                if(Map[s[start++]]-- == 1) maxLetters++;\n            }\n            if(end - start + 1 == minSize) \n                ans = max(ans, ++substrOccur[s.substr(start, minSize)]);\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'String', 'Sliding Window', 'C++']