14. Window with the Most Vowels
Easy
Given a string texto and an integer k, return the maximum number of vowels in any contiguous substring of exactly k characters. Consider a, e, i, o, u as vowels, case-insensitively. If k is zero or the string is empty, return 0.
Example 1
Input: texto = "programacao", k = 4
Output: 2
Explanation: The substring "acao" contains two vowels.
Example 2
Input: texto = "XYZ", k = 2
Output: 0
Constraints
- 0 <= texto.length <= 10^5
- 0 <= k <= texto.length
StringsSliding window
Saved in this browser
Caso 1
texto =
"programacao"
k =
4
Expected =
3
Caso 2
texto =
"XYZ"
k =
2
Expected =
0
Run checks these 2 cases. Submit runs all 6, including hidden ones.