无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode 1456. Maximum Number of Vowels in a Substring of Given

2023-02-12 08:12 作者:您是打尖兒還是住店呢  | 我要投稿

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:

Input: s = "abciiidef", k = 3Output: 3Explanation: The substring "iii" contains 3 vowel letters.

Example 2:

Input: s = "aeiou", k = 2Output: 2Explanation: Any substring of length 2 contains 2 vowels.

Example 3:

Input: s = "leetcode", k = 3Output: 2Explanation: "lee", "eet" and "ode" contain 2 vowels.

?

Constraints:

  • 1 <= s.length <= 105

  • s?consists of lowercase English letters.

  • 1 <= k <= s.length

1:寫一個方法,判斷是否是元音字母;

2:設(shè)置一個前綴和的數(shù)組;

3:依次判斷連續(xù)K個數(shù)字之和,保存最大值;

4:返回最大值;



Runtime:?7 ms, faster than?99.58%?of?Java?online submissions for?Maximum Number of Vowels in a Substring of Given Length.

Memory Usage:?43.2 MB, less than?31.48%?of?Java?online submissions for?Maximum Number of Vowels in a Substring of Given Length.


LeetCode 1456. Maximum Number of Vowels in a Substring of Given 的評論 (共 條)

分享到微博請遵守國家法律
玉环县| 通江县| 溧水县| 那曲县| 霍林郭勒市| 舞阳县| 乌拉特前旗| 瑞昌市| 莎车县| 通道| 平阴县| 深水埗区| 大新县| 丽江市| 加查县| 桃江县| 永兴县| 德保县| 雅安市| 许昌县| 黑水县| 开平市| 安塞县| 沙坪坝区| 来凤县| 铅山县| 呼伦贝尔市| 台北县| 新丰县| 鄂伦春自治旗| 阿合奇县| 民丰县| 福贡县| 阳谷县| 菏泽市| 曲阜市| 石阡县| 库尔勒市| 渭南市| 喀喇| 左权县|