Trains the technique from
LeetCode 2062Count Vowel Substrings of a StringThis 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.
A speech-training tool scans a lowercase transcription text for stretches that drill all five vowel sounds.
A vowel window is a non-empty contiguous stretch of text that contains no consonant and in which each of a, e, i, o and u appears at least once. Two windows count separately when they begin or end at different positions, even if they spell the same thing.
Return the number of vowel windows in text.
Example 1
The windows are "aeiou" starting at 0, "aeioua" starting at 0 and "eioua" starting at 1.
Example 2
The whole transcription is the only window; every shorter stretch is missing a vowel.
Example 3
The five characters before the z form one window and the five after it form another; no window can span the z.
Example 4
No stretch of this transcription contains all five vowels.
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 count_vowel_substrings(text: str) -> int:public int countVowelSubstrings(String text)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.