Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Maximum Number of Vowels in a Substring of Given Length
Bookmark
Brute Force
Sliding Window
Input
Example 1
Example 2
Example 3
No Vowels
Custom
s
=
abciiidef
,
k
=
3
k =
3
0
1
2
3
4
5
6
7
8
a
b
c
i
i
i
d
e
f
k =
3
0
1
2
3
4
5
6
7
8
a
b
c
i
i
i
d
e
f
k =
3
count =
1
maxVowels =
0
0
1
2
3
4
5
6
7
8
window
a
b
c
i
i
i
d
e
f
'b'
is not a vowel
count = 1
k =
3
count =
0
maxVowels =
1
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
'c'
is not a vowel
count = 0
k =
3
count =
0
maxVowels =
1
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
'c'
is not a vowel
count = 0
k =
3
count =
2
maxVowels =
2
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
2
>
1
new best
maxVowels =
2
k =
3
count =
3
maxVowels =
3
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
3
>
2
new best
maxVowels =
3
k =
3
count =
2
maxVowels =
3
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
'd'
is not a vowel
count = 2
k =
3
count =
1
maxVowels =
3
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
'd'
is not a vowel
count = 1
k =
3
count =
1
maxVowels =
3
0
1
2
3
4
5
6
7
8
window
best
a
b
c
i
i
i
d
e
f
'e'
is a vowel
count =
0
+
1
=
1
k =
3
maxVowels =
3
0
1
2
3
4
5
6
7
8
best
a
b
c
i
i
i
d
e
f
maxVowels =
3
window [3..5]
algo
master
.
io
Step:
Find max vowels in any substring of length 3
0 / 30
Input
Example 1
Example 2
Example 3
No Vowels
Custom
s
=
abciiidef
,
k
=
3
0 / 30
algo
master
.
io
Step:
Find max vowels in any substring of length 3