C++ || EASY TO UNDERSTAND || SLIDING WINDOW || MAPS
\n\n# Approach\nuse two maps one to find the unique character and othe rto store the count of valid substrings. Now just move the window with size of minSize be
\n\n# Approach\nuse two maps one to find the unique character and othe rto store the count of valid substrings. Now just move the window with size of minSize because we ave to find the maximum occurence of a substring so we dont use maxSize.After this it simple sliding window problem of fixed size.\n\nUPVOTE :)\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxl, int mins, int maxs) {\n        int n = s.size();\n        int i = 0, j=0;\n        map<char, int> m;\n        map<string, int> m2;\n        while(j < n )\n        {\n            m[s[j]]++;\n            int k = m.size();\n            if(j-i+1 < mins) j++;\n            else\n            {\n                if(k <= maxl)\n                {\n                    m2[s.substr(i,j-i+1)]++;\n\n                }\n                m[s[i]]--;\n                if(m[s[i]] ==0)\n                {\n                    m.erase(s[i]);\n                }\n                i++;\n                j++;\n            }\n            \n        }\n        int maxi = 0;\n        for(auto x : m2)\n        {\n            maxi = max(maxi, x.second);\n        }\n        return maxi;\n    }\n};\n```
['C++']