java.lang.Object
g2501_2600.s2586_count_the_number_of_vowel_strings_in_range.Solution

public class Solution extends Object
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 = [&ldquo;are&rdquo;,&ldquo;amy&rdquo;,&ldquo;u&rdquo;], left = 0, right = 2</p> <p><strong>Output:</strong> 2</p> <p><strong>Explanation:</strong></p> <ul> <li> <p>&ldquo;are&rdquo; is a vowel string because it starts with &lsquo;a&rsquo; and ends with &lsquo;e&rsquo;.</p> </li> <li> <p>&ldquo;amy&rdquo; is not a vowel string because it does not end with a vowel.</p> </li> <li> <p>&ldquo;u&rdquo; is a vowel string because it starts with &lsquo;u&rsquo; and ends with &lsquo;u&rsquo;. 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 = [&ldquo;hey&rdquo;,&ldquo;aeo&rdquo;,&ldquo;mu&rdquo;,&ldquo;ooo&rdquo;,&ldquo;artro&rdquo;], left = 1, right = 4</p> <p><strong>Output:</strong> 3</p> <p><strong>Explanation:</strong></p> <ul> <li> <p>&ldquo;aeo&rdquo; is a vowel string because it starts with &lsquo;a&rsquo; and ends with &lsquo;o&rsquo;.</p> </li> <li> <p>&ldquo;mu&rdquo; is not a vowel string because it does not start with a vowel.</p> </li> <li> <p>&ldquo;ooo&rdquo; is a vowel string because it starts with &lsquo;o&rsquo; and ends with &lsquo;o&rsquo;.</p> </li> <li> <p>&ldquo;artro&rdquo; is a vowel string because it starts with &lsquo;a&rsquo; and ends with &lsquo;o&rsquo;.</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 Details

    • Solution

      public Solution()
  • Method Details

    • vowelStrings

      public int vowelStrings(String[] words, int left, int right)