Golang | O(N) time, O(1) mem | Always choose minSize + Explain
if any substring S\' with size d is valid and has occurence c, then any substring of S\' is also valid and has occurrence at least c. So, we just need to choose
if any substring S\' with size `d` is valid and has occurence `c`, then any substring of S\' is also valid and has occurrence at least `c`. So, we just need to choose `minSize` as sliding window.\n\n```go\nfunc maxFreq(s string, maxLetters int, minSize int, maxSize int) int {\n    var count [26]byte\n    \n    m := make(map[string]int)\n    unique := 0\n    for i := range s {\n        if i >= minSize {\n            if ch := s[i - minSize] - \'a\'; count[ch] == 1 {\n                count[ch] = 0\n                unique--\n            } else {\n                count[ch]--\n            }    \n        }\n        \n        if ch := s[i] - \'a\'; count[ch] == 0 {\n            count[ch] = 1 \n            unique++\n        } else {\n            count[ch]++\n        }\n        \n        if i + 1 >= minSize && unique <= maxLetters {\n             m[s[i + 1 - minSize:i+1]]++\n        }\n    }\n    \n    max := 0\n    for _, v := range m {\n        if v > max {\n            max = v\n        }\n    }\n    \n    return max\n} \n```
['Go']