Maximum Number of Vowels in a Substring of Given Length
MediumSliding Window
Decode it first. Clues, constraints, pattern and plan before any code.Given a lowercase string s and an integer k, return the most vowels found in any substring of length k. The vowels are a, e, i, o and u.
s = "abciiidef", k = 3 → 3 ("iii")
s = "leetcode", k = 3 → 2 ("lee", "eet" or "ode")
s = "rhythms", k = 4 → 0Constraints
1 <= s.length <= 10^5sconsists of lowercase English letters.1 <= k <= s.length