← 返回 snapchat 的题目列表Maximum Number of Vowels in a Substring of Given Length
类型:online_judge
Given a string s consisting of lowercase English letters and an integer k, find the maximum number of vowels (a, e, i, o, u) in any contiguous substring of s with length k, and return that maximum.
Constraints:
1 <= len(s) <= 2 * 10^5
1 <= k <= len(s)
Expected time complexity: O(n)
Example 1:
Input: s = "abciiidef", k = 3
Output: 3
Example 2:
Input: s = "aeiou", k = 2
Output: 2
Example 3:
Input: s = "leetcode", k = 3
Output: 2
Example
Input
abciiidef
3
Output
3