Given a string array that containsnelements, each composed of lowercase English letters, and q queries, eacl 1-r, for each query, determine how many strings starting from index / and ending at index r have vowels as the character. Vowels are in{a,e,l,0,u). Example strArr = [aba;,bcb;'ece;;aa;,e'] queries=[1−3;2−5 i,2−2 ′]These strings represent two dash delimited integers l andr , the ​ start and end indices of the interval, inclusive. indexing in the string array, the interval 1-3 contains two strings that start and end with a vowel: 'aba' and 'ece'. 5 also has three. The third interval, from 2-2, the only element in the interval, 'bcb' does not begin and end with array for the queries is[2,3,0]. Function Description Complete the hasVowels function in the editor below. It must return an array of integers that represent the resul the order given. hasvowels has the following parameters. strArr stringl: an array ofnstrings query stringD: an array of q strings, each of which describes an interval /rrusing integers delimited by a dash Constraints -1≤n.q≤10 5-1≤l≤r≤n- 1 s size of strarrUI 10 Input Format For Custom Testing - Sample Case 0 Sample Input For Custom Testing sroni function s→strarr[i sizen=5- strarr = [ "aab", "a", "bed", "awe", "bbbbbu"]bcal dace Etrobbu

Respuesta :

Using the knowledge in computational language in python it is possible to write a code that Given a string array that containsnelements, each composed of lowercase English letters, and q queries, eacl 1-r.

Writting the code:

function hasVowels(strArr, query) {

       //variable to keep track of which index of the query we are on;

       let queryCounter = 0;

       //return array of solution

       let returnQuery = [];

       //loop through query array to determine vowel count

       query.every((q) => {

         //index1 and index 1 => get them from the query then make them into integers with + sign.

         let index1 = +query[queryCounter][0];

         let index2 = +query[queryCounter][2];

         if (index1 < 1) {

           return false;

         }

         if (index2 > strArr.length) {

           return false;

         }

         if (index1 > index2) {

           return false;

         }

         //increase query counter to get the next set of indexes.

         queryCounter += 1;

         let vowelCounter = 0;

         //loop through the vowel array to determine the count. the loop will start at the index1 and stop at index 2 as per the requirements of the problem.

         for (let start = index1 - 1; start <= index2 - 1; start += 1) {

           let firstLetter = strArr[start][0];

           let lastLetter = strArr[start].slice(-1);

           if (isVowel(firstLetter) && isVowel(lastLetter)) {

             vowelCounter += 1;

           }

         }

         returnQuery.push(vowelCounter);

         vowelCounter = 0;

         return true;

       });

       if (returnQuery.length === 0) {

         return [0];

       }

       return returnQuery;

     }

     function isVowel(c) {

       return ["a", "e", "i", "o", "u"].indexOf(c.toLowerCase()) !== -1;

     }

See more about python at brainly.com/question/18502436

#SPJ1

Ver imagen lhmarianateixeira