Count Vowel Strings in Ranges
A medium-tier problem at 68% community acceptance, tagged with Array, String, Prefix Sum. Reported in interviews at PayPal and 2 others.
Count Vowel Strings in Ranges shows up in assessments at PayPal, IBM, and Atlassian. You're given an array of strings and multiple range queries, and you need to count how many strings in each range start and end with a vowel. The naive approach iterates through each range on every query, which tanks on large datasets. The trick is prefix sums. Build a prefix array once, answer each query in constant time. With a 68% acceptance rate, this problem catches candidates who don't recognize the optimization opportunity. If you blank on prefix sum during your OA, StealthCoder surfaces the pattern in seconds, invisible to the proctor.
Companies that ask "Count Vowel Strings in Ranges"
Count Vowel Strings in Ranges is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderThe gotcha is that your first instinct is often a loop. For each query, you iterate the range and check each string. It works on small inputs but fails at scale. The real solution uses prefix sums: precompute a running count of valid strings (those starting and ending with vowels) up to each index. Then each query is just a subtraction. The topics reflect this exactly: Array handling, String character checks, and Prefix Sum pattern. Candidates who jump straight to nested loops rarely optimize in time. Prefix sum isn't hard once you see it, but the pressure of a live assessment makes the pattern easy to miss. StealthCoder is the hedge for that moment when the brute force approach times out and you're stuck.
Pattern tags
You know the problem.
Make sure you actually pass it.
Count Vowel Strings in Ranges recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Count Vowel Strings in Ranges interview FAQ
Is this problem actually asked at big companies?+
Yes. PayPal, IBM, and Atlassian all report this problem. It's a medium difficulty, so expect it in mid-level or senior IC rounds. The 68% acceptance rate suggests it's not a weed-out, but candidates who don't optimize get caught.
What's the real trick?+
Prefix sums. Precompute a cumulative count of valid strings (start and end with a vowel) at each position. Then answer any range query in O(1) time instead of O(n) per query. That's the optimization separators see.
What vowels count?+
The input doesn't specify, but standard approach is 'a', 'e', 'i', 'o', 'u' (lowercase). Check the problem statement for case sensitivity. Most problems assume lowercase, but clarify if the input includes uppercase strings.
How do I test if a string starts and ends with a vowel?+
Check the first character and last character separately. Both must be vowels. A single-character string counts only if that character is a vowel. Use a set or simple conditional to avoid typos under time pressure.
Why does the naive loop approach fail?+
If you iterate the range for every query, you're O(n*m) where n is the number of queries and m is average range size. With large inputs, that times out. Prefix sum preprocessing is O(n) once, then O(1) per query. That's O(n + m) total. Speed matters in live assessments.
Want the actual problem statement? View "Count Vowel Strings in Ranges" on LeetCode →