mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
56 lines
2.1 KiB
HTML
56 lines
2.1 KiB
HTML
<p>You are given a string <code>word</code> and a <strong>non-negative</strong> integer <code>k</code>.</p>
|
|
|
|
<p>Return the total number of <span data-keyword="substring-nonempty">substrings</span> of <code>word</code> that contain every vowel (<code>'a'</code>, <code>'e'</code>, <code>'i'</code>, <code>'o'</code>, and <code>'u'</code>) <strong>at least</strong> once and <strong>exactly</strong> <code>k</code> consonants.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">word = "aeioqq", k = 1</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">0</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<p>There is no substring with every vowel.</p>
|
|
</div>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">word = "aeiou", k = 0</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">1</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<p>The only substring with every vowel and zero consonants is <code>word[0..4]</code>, which is <code>"aeiou"</code>.</p>
|
|
</div>
|
|
|
|
<p><strong class="example">Example 3:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">word = "</span>ieaouqqieaouqq<span class="example-io">", k = 1</span></p>
|
|
|
|
<p><strong>Output:</strong> 3</p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<p>The substrings with every vowel and one consonant are:</p>
|
|
|
|
<ul>
|
|
<li><code>word[0..5]</code>, which is <code>"ieaouq"</code>.</li>
|
|
<li><code>word[6..11]</code>, which is <code>"qieaou"</code>.</li>
|
|
<li><code>word[7..12]</code>, which is <code>"ieaouq"</code>.</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>5 <= word.length <= 2 * 10<sup>5</sup></code></li>
|
|
<li><code>word</code> consists only of lowercase English letters.</li>
|
|
<li><code>0 <= k <= word.length - 5</code></li>
|
|
</ul>
|