Class Solution
java.lang.Object
g2501_2600.s2586_count_the_number_of_vowel_strings_in_range.Solution
2586 - Count the Number of Vowel Strings in Range.<p>Easy</p>
<p>You are given a <strong>0-indexed</strong> array of string <code>words</code> and two integers <code>left</code> and <code>right</code>.</p>
<p>A string is called a <strong>vowel string</strong> if it starts with a vowel character and ends with a vowel character where vowel characters are <code>'a'</code>, <code>'e'</code>, <code>'i'</code>, <code>'o'</code>, and <code>'u'</code>.</p>
<p>Return <em>the number of vowel strings</em> <code>words[i]</code> <em>where</em> <code>i</code> <em>belongs to the inclusive range</em> <code>[left, right]</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> words = [“are”,“amy”,“u”], left = 0, right = 2</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong></p>
<ul>
<li>
<p>“are” is a vowel string because it starts with ‘a’ and ends with ‘e’.</p>
</li>
<li>
<p>“amy” is not a vowel string because it does not end with a vowel.</p>
</li>
<li>
<p>“u” is a vowel string because it starts with ‘u’ and ends with ‘u’. The number of vowel strings in the mentioned range is 2.</p>
</li>
</ul>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> words = [“hey”,“aeo”,“mu”,“ooo”,“artro”], left = 1, right = 4</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong></p>
<ul>
<li>
<p>“aeo” is a vowel string because it starts with ‘a’ and ends with ‘o’.</p>
</li>
<li>
<p>“mu” is not a vowel string because it does not start with a vowel.</p>
</li>
<li>
<p>“ooo” is a vowel string because it starts with ‘o’ and ends with ‘o’.</p>
</li>
<li>
<p>“artro” is a vowel string because it starts with ‘a’ and ends with ‘o’.</p>
</li>
</ul>
<p>The number of vowel strings in the mentioned range is 3.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= words.length <= 1000</code></li>
<li><code>1 <= words[i].length <= 10</code></li>
<li><code>words[i]</code> consists of only lowercase English letters.</li>
<li><code>0 <= left <= right < words.length</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
vowelStrings
-