Python solutions with video explanation
Solution 1\n\ndef maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int:\n\tocc, n = collections.defaultdict(int), len(s)\n\tfor i in range(
Solution 1\n```\ndef maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int:\n\tocc, n = collections.defaultdict(int), len(s)\n\tfor i in range(n):\n\t\tfor j in range(i + minSize - 1, min(i + maxSize, n)):\n\t\t\tsub = s[i:j + 1]\n\t\t\tif len(set(sub)) <= maxLetters:\n\t\t\t\tocc[sub] += 1\n\n\treturn max(occ.values(), default=0)\n```\n\t\t\nSolution 2\n\n```\ndef maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int: \n\tres, occ, n = 0, collections.defaultdict(int), len(s)\n\tfor i in range(n - minSize + 1): \n\t\tsub = s[i:i + minSize]\n\t\tif len(set(sub)) <= maxLetters:\n\t\t\tocc[sub] += 1\n\t\t\tres = max(res, occ[sub])\n\treturn res\n```\n\n**Video Explanation**\nhttps://www.youtube.com/watch?v=lch2M9LPX5k
[]