Trains the technique from
LeetCode 2559Count Vowel Strings in RangesThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Labels are given as words, and each entry of queries is a pair [l, r] naming a stretch of the list, ends included.
A label is vowel-bounded when both its first and its last character are vowels, that is one of 'a', 'e', 'i', 'o' or 'u'. A label of one character counts when that character is a vowel.
Return, for each stretch in turn, how many vowel-bounded labels it holds.
Example 1
"aria" and "echo" both begin and end with a vowel; "opal" ends in a consonant, and "brick" and "damp" begin with one. So the whole list holds two, the middle stretch holds two, and the last two stretches hold one and none.
Example 2
The label "ba" begins with a consonant, so it does not count even though it ends with a vowel.
Example 3
A label of one character counts when that character is a vowel, so it is both the first and the last.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def vowel_strings(words: list[str], queries: list[list[int]]) -> list[int]:public int[] vowelStrings(String[] words, int[][] queries)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.