Tap here to switch tabs
Problem
Submissions

Problem: Count Vowel Strings in Ranges

med
30 min
Try to solve the Count Vowel Strings in Ranges problem.

Statement

You are given an array of strings words and a list of range queries queries. Each query is a pair of indices [l_i, r_i] that refers to the subarray words[l_i..r_i] (inclusive).

For each query, return how many strings in the specified range both start and end with a vowel. Vowels are the lowercase letters a, e, i, o, and u.

Return an array of answers in the same order as queries.

Constraints:

  • 1≤1 \leq words.length ≤105\leq 10^5

  • 1≤1 \leq words[i].length ≤40\leq 40

  • words[i] consists only of lowercase English letters

  • ∑\sum(words[i].length) ≤3⋅105\leq 3 \cdot 10^5

  • 1≤1 \leq queries.length ≤105\leq 10^5

  • 0≤0 \leq l_i ≤\leq r_i << words.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Vowel Strings in Ranges

med
30 min
Try to solve the Count Vowel Strings in Ranges problem.

Statement

You are given an array of strings words and a list of range queries queries. Each query is a pair of indices [l_i, r_i] that refers to the subarray words[l_i..r_i] (inclusive).

For each query, return how many strings in the specified range both start and end with a vowel. Vowels are the lowercase letters a, e, i, o, and u.

Return an array of answers in the same order as queries.

Constraints:

  • 1≤1 \leq words.length ≤105\leq 10^5

  • 1≤1 \leq words[i].length ≤40\leq 40

  • words[i] consists only of lowercase English letters

  • ∑\sum(words[i].length) ≤3⋅105\leq 3 \cdot 10^5

  • 1≤1 \leq queries.length ≤105\leq 10^5

  • 0≤0 \leq l_i ≤\leq r_i << words.length