Easily Understandable C++ Code || Sliding Window || 2 Pointers
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```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) \n    {\n        unordered_map<string, int> mp2;\n        unordered_map<char, int> mp;\n        int distinct = 0;\n        int i=0, j=0;\n        int cnt = 0;\n        while(j < s.size())\n        {\n            if(mp[s[j]] == 0) distinct++;\n            mp[s[j]]++;\n            while(j-i+1 > maxSize || distinct > maxLetters)\n            {\n                mp[s[i]]--;\n                if(mp[s[i]] == 0) distinct--;\n                i++;\n            }\n            while(j-i+1 >= minSize && distinct <= maxLetters)\n            {\n                mp2[s.substr(i, j-i+1)]++;\n                mp[s[i]]--;\n                if(mp[s[i]] == 0) distinct--;\n                i++;\n            }\n            j++;\n        }      \n        for(auto it : mp2)\n        {\n            cnt = max(cnt, it.second);\n        }\n        return cnt;\n    }\n};\n```
['Two Pointers', 'Sliding Window', 'C++']