Answer: FINBOX Hiring | Off-Campus OA (2023) | Count Vowel Substrings of a Word
Answer · Posted Jun 2026
Approach Since the string length is at most 100, we can use a brute-force approach. For every starting position: Extend the substring one character at a time. Stop immediately if a consonant is encountered. Maintain the frequency of the five vowels. Whenever all five vowels have appeared, increment the answer. Strategy Iterate through every starting index. Maintain: Frequency array for vowels. Number of distinct vowels seen. Expand until a consonant is found. Count every substring containing all five vowels. Java ...
The full answer & interview discussion are available to premium members.
Log in Create a free account