[Java] HashMap + Bitmap O(N) Solution
\nclass Solution {\n    public int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n        Map<String, Integer> map = new HashMap<>();\n        i
```\nclass Solution {\n    public int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n        Map<String, Integer> map = new HashMap<>();\n        int len = s.length();\n        int maxFreq = 0;\n        \n        for(int i = 0; (i + minSize - 1) < len; ++i){\n            int bitmap = 0;\n            \n            for(int j = i; j < len && (j - i) < maxSize; ++j){\n                bitmap |= 1 << (s.charAt(j) - \'a\');\n            \n                if(Integer.bitCount(bitmap) > maxLetters) break;\n                \n                if(j - i + 1 >= minSize){\n                    String subString = s.substring(i, j + 1);\n                    int freq = map.getOrDefault(subString, 0) + 1;\n                    maxFreq = Math.max(maxFreq, freq);\n                    map.put(subString, freq);\n                }\n            }\n        }\n        \n        return maxFreq;\n    }\n}\n```
['Java']