Java - Easy to understand (75%)
\nclass Solution {\n    public int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n       //MaxSize is useless because  let\'s say if a string of
```\nclass Solution {\n    public int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n       //MaxSize is useless because  let\'s say if a string of length 2 has highest occurence then increasing the length of the string is only going to decrease it\'s occurence \n        Map<String, Integer> map = new HashMap();\n        int max = 0;\n        int n = minSize;\n\t\t//Start checking occurence of substring from startIndex = 0 to s.lengt() - minSize\n        for (int i = 0; i <= s.length() - n; i++) {\n                String cur = s.substring(i, i+n);\n                int freq = 0;\n                if (map.containsKey(cur)) {\n                    freq = map.get(cur);\n                    freq++;\n                    map.put(cur, freq);\n                    \n                } else {\n                    if (isStringValid(cur, maxLetters)) {\n                        freq = 1;\n                        map.put(cur, freq);\n                    }\n                }\n                if (freq > max) {\n                        max = freq;\n                }\n            }\n        return max;\n    }\n    \n\t//Check if string has no. of unique chars less than or equal to allowed value\n    private boolean isStringValid(String s, int max) {\n        Set<Integer> set = new HashSet();\n        for(int i = 0; i < s.length(); i++) {\n            char cur = s.charAt(i);\n            set.add(cur - \'a\');\n            if (set.size() > max) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n```
[]