Leetcode#1456. Maximum Number of Vowels in a Substring of Given Length
Problem
Given a string s
and an integer k
, return the maximum number of vowel letters in any substring of s
with length k
.
Vowel letters in English are 'a'
, 'e'
, 'i'
, 'o'
, and 'u'
.
Example 1:
1 | Input: s = "abciiidef", k = 3 |
Example 2:
1 | Input: s = "aeiou", k = 2 |
Example 3:
1 | Input: s = "leetcode", k = 3 |
Constraints:
1 <= s.length <= 10^5
s
consists of lowercase English letters.1 <= k <= s.length
Solve
醜醜
1 | class Solution: |
https://pochunyeh.com/posts/z/Leetcode-1456-Maximum-Number-of-Vowels-in-a-Substring-of-Given-Length/
本部落格所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。轉載請註明來自 Imisky!
評論