c++ | hashing | 85% faster than all
```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) \n    {\n        int i=0,j=0,res=0,unique=0;\n        vector
```\nclass Solution {\npublic:\n    int maxFreq(string s, int maxLetters, int minSize, int maxSize) \n    {\n        int i=0,j=0,res=0,unique=0;\n        vector<int> cnt(26,0);\n        unordered_map<string,int> m;\n        while(j<s.size())\n        {\n            if(++cnt[s[j++]-\'a\']==1)\n                ++unique;\n            while(unique>maxLetters||j-i>minSize)\n            {\n                if(--cnt[s[i++]-\'a\']==0)\n                   --unique;\n            }\n            if(j-i==minSize)\n            {\n                res=max(res,++m[s.substr(i,minSize)]);\n            }\n            \n        }\n        return res;\n    }\n};
[]