Count Vowel Substrings of a String
A easy-tier problem at 71% community acceptance, tagged with Hash Table, String. Reported in interviews at Commvault and 4 others.
Count Vowel Substrings of a String is an easy problem that appears in live assessments at Commvault, Snowflake, BNY Mellon, PayPal, and Oracle. The acceptance rate sits at 71%, which means most candidates get it right, but the ones who don't usually miss it because they overthink the substring logic or miscount edge cases. You need to find every contiguous substring that starts and ends with a vowel and contains only vowels. It's a straightforward pattern-match, but if you blank during your OA, StealthCoder solves it invisibly in seconds so you don't waste time on what should be a quick win.
Companies that ask "Count Vowel Substrings of a String"
Count Vowel Substrings of a String 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe trick is recognizing that you don't need to generate all substrings. Instead, count the length of each contiguous vowel-only run. If a run has length N, it contributes N*(N+1)/2 valid substrings (every substring within that run starts and ends with a vowel by definition). Candidates often loop through generating substrings explicitly, which works but is slower and error-prone. The real gotcha is forgetting that 'y' is not a vowel in this context, and mishandling the boundaries between vowel clusters. Hash Table and String are the tagged topics because you either hash which characters are vowels or iterate through the string checking membership. If you hit this during an assessment and don't immediately see the arithmetic shortcut, StealthCoder delivers the counting formula and implementation in one glance.
Pattern tags
You know the problem.
Make sure you actually pass it.
Count Vowel Substrings of a String recycles across companies for a reason. It's easy-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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Count Vowel Substrings of a String interview FAQ
Is this actually asked at Snowflake and PayPal, or is that rumor?+
It's reported in interview tracking data from both companies. That said, it's an easy problem, so if it shows up in your loop, it's usually early or as a warm-up. The 71% acceptance rate confirms most people solve it. Don't overthink it during the OA.
What's the difference between String and Hash Table approaches here?+
String iteration means you walk the input once, tracking vowel run lengths. Hash Table means you pre-build a set of vowels for O(1) lookups as you walk. Both are O(N) time. Hash Table is slightly cleaner for reusability if the vowel set changes, but String iteration is just as fast and fewer lines of code.
Do I really need to generate all substrings?+
No. That's the speed trap. Generate substrings and check each one, and you're O(N^2) or worse. Use the formula: if a contiguous vowel run has length N, it contributes N*(N+1)/2 valid substrings. One pass, O(N) time, way cleaner.
Why is the acceptance rate 71% if it's easy?+
Because candidates rush. They miscount, forget edge cases at string boundaries, or burn time generating and filtering substrings. The problem itself is trivial once you see the pattern, but live-exam rush makes people mess up what should be a gimme.
What's the common mistake that tanks this problem?+
Not realizing 'y' is not a vowel, and trying to check if a substring is 'all vowels' by comparing to a set instead of just counting runs. Also, off-by-one errors on substring boundaries. It's easy to fail an easy problem when you're stressed and not focused.
Want the actual problem statement? View "Count Vowel Substrings of a String" on LeetCode →