Count Vowel Substrings of a String
Updated
Problem statement
A vowel substring is a non-empty contiguous substring that contains only the lowercase vowels a, e, i, o, and u, and contains all five vowels at least once.
Given a lowercase English string word, return the number of vowel substrings.
Function
countVowelSubstrings(word: String) → longExamples
Example 1
word = "aeiouu"return = 2The valid substrings are aeiou and aeiouu.
Example 2
word = "unicornarihan"return = 0The vowels are split apart by consonants, so no stretch of only vowels holds all five kinds. The answer is zero.
Example 3
word = "cuaieuouac"return = 7The stretch of vowels uaieuoua sits between two c letters. Seven substrings inside it contain all five vowel kinds.
Constraints
1 <= word.length() <= 100000.wordcontains only lowercase English letters.- The answer fits in a signed 64-bit integer.
More Bloomberg LP Phone Screen questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Perfect SubstringsVisa · OAVisa interview questions
- Longest Substring Without Repeating CharactersAngel One · PHONE SCREEN
- Longest Substring Without Repeating CharactersNykaa · PHONE SCREENNykaa interview questions
- Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
- Longest Substring Without Repeating CharactersIBM · PHONE SCREENIBM interview questions
- Longest Substring Without Repeating CharactersTikTok · PHONE SCREENTikTok interview questions
- Find Word-Multiset WindowsAmazon · PHONE SCREEN
- Find the First Contiguous HaikuFaire · PHONE SCREEN
- Shortest Deletion for a Distinct RemainderGoogle · PHONE SCREENGoogle interview questions
- Longest Substring Without Repeating CharactersCapgemini · PHONE SCREENCapgemini interview questions