无码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 的評論 (共 條)

分享到微博請遵守國家法律
大埔区| 荔波县| 永德县| 东莞市| 南城县| 商丘市| 锡林浩特市| 涪陵区| 永德县| 富顺县| 蕉岭县| 沐川县| 虎林市| 仙游县| 永顺县| 进贤县| 广平县| 柳河县| 漳州市| 乌拉特中旗| 大竹县| 南溪县| 长寿区| 廉江市| 寻乌县| 永嘉县| 大关县| 鄂托克前旗| 厦门市| 竹山县| 马龙县| 广昌县| 青阳县| 利川市| 宁强县| 新绛县| 南皮县| 潢川县| 龙海市| 朔州市| 吉林市|