C++|| EASY EXPLANATION || HASHMAP +  GREEDY APPROACH
\n/\n\n\n\nFirst Notice in the constraints section : 1 <= minSize <= maxSize <= min(26, s.length)\n\nThat means maxsize should not exceed 26 that is why we come
\n/*\n\n\n\nFirst Notice in the constraints section : 1 <= minSize <= maxSize <= min(26, s.length)\n\nThat means maxsize should not exceed 26 that is why we come with a code of O(26*n) Time Complexity.\n\n*** Again there is a key note : that is we should not bother of maxSize because we gonna find a substring with minSize andunique characters atmost maxLetters.\n\n*** If you think over it deeply you can easily figure out that they are asking Maximum number of occurences of a particular Substring satisfying Given Constraints.\n\n*** That means we are in search of maximum occurence of a substring with minSize , because substring with (minSize==len) already included in substring with (maxSize >=len+1 )\n\ns=""aababcaab" --> Here the substring "aab" already included in "aaba" so it doesn\'t make any sense to counter maxSize substrings.\n\n\n\n*/\n\nclass Solution {\npublic:\n    \n    int count_unique_char(string s){\n        \n        set<char>st;\n        \n        for(int i=0;i<s.length();i++){\n            st.insert(s[i]);\n        }\n        \n        return st.size();\n        \n    }\n    \n    \n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n        \n        int n=s.length();\n        \n        if(n<maxLetters){\n            return 0;\n        }\n        \n        map<string,int>mp;\n        \n        int maxval=0;\n        \n        for(int i=0;i<=n-minSize;i++){\n            \n            string sub=s.substr(i,minSize);\n            \n            if(count_unique_char(sub)<=maxLetters){\n                mp[sub]++;\n            }\n            \n            maxval=max(maxval,mp[sub]);\n            \n        }\n        \n        return maxval;\n        \n    }\n};
[]