Basic example
Input
s = "abciiidef", k = 3
Output
3
The substring "iii" contains 3 vowels which is the maximum for any window of size 3.
Full lesson preview
Find the maximum number of vowels contained in any substring of length K using a sliding window.
Problem statement
Task
Examples
Input
s = "abciiidef", k = 3
Output
3
The substring "iii" contains 3 vowels which is the maximum for any window of size 3.
Input format
Output format
Constraints
Samples
Input
s = "aeiou", k = 2
Output
2
Every window of size 2 contains 2 vowels at most.