Description
Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k.
Examples
Input:
s = "abciiidef", k = 3Output:
3Explanation:
Sliding window of size 3: substring 'iii' at positions 3-5 contains all vowels. Maximum count: 3.
Input:
s = "leetcode", k = 3Output:
2Explanation:
The substring "eec" contains 2 vowels (e, e), which is the maximum possible for any substring of length 3.
Input:
s = "programming", k = 4Output:
2Explanation:
Multiple substrings of length 4 contain exactly 1 vowel each (like "prog", "rogr", "ogra", "gram", "ramm", "ammi", "mmin", "ming"), and this is the maximum possible.
Constraints
- •
1 ≤ s.length ≤ 10⁵