Given a string array that contains
n
elements, each composed of lowercase English letters, and q queries, each query of the format
/−r
, for each query, determine how many strings starting from index / and ending at index r have vowels as the first and last character. Vowels are in
{a,e,i,0,u}
. Example strArr = [aba;'bcb;'ece;' 'aa;'e] queries
=[17−3;2−5;2−2]
These strings represent two dash delimited integers / 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]



Answer :

Other Questions