Most Vowels in a Fixed-Length Substring
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
### Problem
Return the largest number of vowel occurrences in any contiguous length-k substring of s. The vowels are exactly a,e,i,o,u.
```cpp
class Solution {
public:
int maxVowels(string s, int k);
};
```
### Examples
**Example 1:**
```text
Input: s = "bace", k = 3
Output: 2
Explanation: The window ace contains a and e.
```
**Example 2:**
```text
Input: s = "xyz", k = 2
Output: 0
Explanation: Neither length2 window contains a vowel.
```
### Constraints
- s contains 1 to 100000 lowercase English letters.
- `1 <= k <= s.length`.
### Contract considerations
Only lowercase English letters occur, and y is not a vowel.
```hint Read the boundary condition
Count vowel occurrences rather than distinct vowel letters. Every candidate substring has exactly the requested length.
```
### Boundary reminders
Only lowercase English letters occur, and y is not a vowel.
Overview: Most Vowels in a Fixed-Length Substring. Return the largest number of vowel occurrences in any contiguous length-k substring of s.