1
var maxFreq = function (s, maxLetters, minSize, maxSize) {13
while (right < s.length) {14
if (map[s[right]] === undefined) {15
// adding letters to map to keep track of occurences (count)19
if (map[s[right]] === 0) {25
if (right - left + 1 > minSize) {26
// once over minSize removing occurence of left most letter from map and adjusting count29
if (map[s[left]] < 1) {35
if (right - left + 1 >= minSize && count <= maxLetters) {36
map2[s.substring(left, right + 1)] =37
(map2[s.substring(left, right + 1)] || 0) + 1; // if subsitrng meets constraints of size and count add to map2;43
Object.entries(map2).map(([key, val]) => (output = Math.max(output, val))); // get largest value in map2