Problem Brief
Has Vowels
NEW GRADOA
Given a string array that contains n elements, each composed of lowercase English letters, and q queries, each query of the format i-r, for each query, determine how many strings starting from index i and ending at index r have vowels as the first and last character. Vowels are in {a,e,i,o,u}.
Function Description
Complete the function hasVowels in the editor below. It must return an array of integers that represent the result of each query in the order given.
hasVowels has the following parameters:
strArr string[]: an array ofnstringsquery string[]: an array ofqstrings, each of which describes an intervali-rusing integers delimited by a dash
1Example 1
Input
strArr = ["aba","bcb","ece","aa","e"], queries = ["1-3","2-5","2-2"]
Output
[2, 3, 0]
Explanation
These strings represent two dash delimited integers
i and r, the start and end indices of the interval, inclusive. Using 1-based indexing in the string array, the interval 1-3 contains two strings that start and end with a vowel: 'aba' and 'ece'. The interval 2-5 also has three. The third interval, from 2-2, the only element in the interval, 'bcb' does not begin and end with a vowel. The return array for the queries is [2, 3, 0].Constraints
Limits and guarantees your solution can rely on.
1 ≤ n, q ≤ 10^51 ≤ i ≤ r ≤ n1 ≤ size of strArr[i] ≤ 10