Skip to main content

Count Vowel Strings in Ranges

MediumArrayStringSortingSQL

Description

Given an array of string queries and strings, for each query find the count of strings where the query is a prefix and string only contains vowels.

Examples

Input:words = ["aba","bcb","ece","aa","e"], queries = [[0,2],[1,4],[1,1]]
Output:[2,3,0]
Explanation:

Counts for each range.

Input:words = ["aba","bcb","ece","aa","e"], queries = [[1]]
Output:[0]
Explanation:

Minimal case with a single query.

Input:words = ["apple", "orange", "banana", "ice", "umbrella", "hello"], queries = [[0,5],[2,4],[3,3]]
Output:[4,2,1]
Explanation:

The three queries return 4, 2, and 1, so the result is [4,2,1].

Constraints

  • 1 ≤ words.length ≤ 10⁵

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.