Count the Number of Vowel Strings in Range

You are given a 0-indexed array of strings words and two integers left and right.

A string is called a vowel string if it starts with a vowel character and ends with a vowel character, where vowel characters are 'a', 'e', 'i', 'o', and 'u'.

Return the number of vowel strings words[i] where i belongs to the inclusive range [left, right].

Example 1
Inputwords = ["are","amy","u"], left = 0, right = 2
Output2
"are" and "u" are vowel strings in the range, while "amy" is not because it does not end with a vowel.
Example 2
Inputwords = ["hey","aeo","mu","ooo","artro"], left = 1, right = 4
Output3
"aeo", "ooo", and "artro" are vowel strings in the range, while "mu" is not because it does not start with a vowel.

Constraints

  • 1 <= words.length <= 1000
  • 1 <= words[i].length <= 10
  • words[i] consists of only lowercase English letters.
  • 0 <= left <= right < words.length

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate