1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/定长子串中元音的最大数目 [maximum-number-of-vowels-in-a-substring-of-given-length].html
2022-03-29 12:43:11 +08:00

52 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你字符串 <code>s</code> 和整数 <code>k</code></p>
<p>请返回字符串 <code>s</code> 中长度为 <code>k</code> 的单个子字符串中可能包含的最大元音字母数。</p>
<p>英文中的 <strong>元音字母 </strong>为(<code>a</code>, <code>e</code>, <code>i</code>, <code>o</code>, <code>u</code>)。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>s = &quot;abciiidef&quot;, k = 3
<strong>输出:</strong>3
<strong>解释:</strong>子字符串 &quot;iii&quot; 包含 3 个元音字母。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>s = &quot;aeiou&quot;, k = 2
<strong>输出:</strong>2
<strong>解释:</strong>任意长度为 2 的子字符串都包含 2 个元音字母。
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>s = &quot;leetcode&quot;, k = 3
<strong>输出:</strong>2
<strong>解释:</strong>&quot;lee&quot;&quot;eet&quot;&quot;ode&quot; 都包含 2 个元音字母。
</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>s = &quot;rhythms&quot;, k = 4
<strong>输出:</strong>0
<strong>解释:</strong>字符串 s 中不含任何元音字母。
</pre>
<p><strong>示例 5</strong></p>
<pre><strong>输入:</strong>s = &quot;tryhard&quot;, k = 4
<strong>输出:</strong>1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 10^5</code></li>
<li><code>s</code> 由小写英文字母组成</li>
<li><code>1 &lt;= k &lt;= s.length</code></li>
</ul>