1456. Maximum Number of Vowels in a Substring of Given Length
1456. Maximum Number of Vowels in a Substring of Given Length
Description
Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k.
Vowel letters in English are 'a', 'e', 'i', 'o', and 'u'.
Example 1:
1 | Input: s = "abciiidef", k = 3 |
Example 2:
1 | Input: s = "aeiou", k = 2 |
Example 3:
1 | Input: s = "leetcode", k = 3 |
Constraints:
1 <= s.length <= 10^5sconsists of lowercase English letters.1 <= k <= s.length
Hints/Notes
- 2024/10/02
- sliding window
- 0x3Fâs solution(checked)
Solution
Language: C++
1 | class Solution { |