Maximum Vowels in a Fixed Window
Given a lowercase string s and an integer k, return the greatest number of vowels in any contiguous substring of s containing exactly k characters. The vowels…
Given a lowercase string `s` and an integer `k`, return the greatest number of vowels in any contiguous substring of `s` containing exactly `k` characters. The vowels are `a`, `e`, `i`, `o`, and `u`.
- `1 <= s.length <= 10^5` - `s` consists only of lowercase English letters. - `1 <= k <= s.length` - The interactive visualizer accepts at most 15 characters; longer valid inputs are execution-only.
Example 1: input s = "abciiidef", k = 3; output 3. The substring "iii" contains three vowels.
Example 2: input s = "rhythms", k = 4; output 0. No substring contains a vowel.
Category: Sliding Window. Topic: sliding-window. Difficulty: Easy. Patterns: sliding-window.