Vowel Substring
Updated
Problem statement
Given a string of lowercase letters in the range ascii[a-z], determine the number of substrings that can be created where every letter is a vowel and every vowel is present at least once. The vowels are ['a', 'e', 'i', 'o', 'u']. A substring is a contiguous group of characters in the string.
Function
vowelSubstring(s: String) → int
Complete the function vowelSubstring in the editor.
vowelSubstring has the following parameter(s):
- 1.
string s: a string
Returns
int: the number of substrings that consist of vowels only ('a', 'e', 'i', 'o', 'u') where every vowel appears at least once
🌷ଓ Credit where it's due – A!˶ᵔ ᵕ ᵔ˶ ᯓᡣ𐭩
Examples
Example 1
s = "aaeiouxa"return = 2There are two qualifying substrings:
s[0:5] = "aaeiou"
s[1:5] = "aeiou"
Example 2
s = "axyzaeiou"return = 1There is only one qualifying substring:
s[4:8] = "aeiou"
Constraints
1 ≤ size_of(s) ≤ 10^5s[i] ∈ ascii[a-z] (where 0 ≤ i < size_of(s))
More Snowflake interview questions
- Minimum StackPHONE SCREEN · Seen Nov 2026
- Design In-Memory File SystemPHONE SCREEN · Seen Nov 2026
- Merge Two Binary TreesPHONE SCREEN · Seen Nov 2026
- Connect Four from the Last MovePHONE SCREEN · Seen Nov 2026
- Minimum Edits to a Perfect Binary TreePHONE SCREEN · Seen Nov 2026
- Parallel Courses IIIONSITE INTERVIEW · Seen Nov 2026
- Safest Shortest Path Through a GridOA · Seen Nov 2026
- Configurable Per-Client Token BucketsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
- LFU CacheOA · ONSITE INTERVIEW · Seen Nov 2026
Similar questions at other companies
- Perfect SubstringAXQ Capital · OA
- Maximum Valid Substring FrequencyMicrosoft · OAMicrosoft interview questions
- Longest Distinct StringSuperhuman · OASuperhuman interview questions
- Longest Substring Without Repeating CharactersAkuna Capital · OAAkuna Capital interview questions
- Perfect SubstringsVisa · OAVisa interview questions
- Count Distinct Fixed-Length SubstringsAdobe · OAAdobe interview questions
- Video ID Generation (Generic)TikTok · OATikTok interview questions
- Unaligned DedupeRubrik · OARubrik interview questions
- Get Max OccurrencesIBM · OAIBM interview questions
- Find P-Matching ScoreAmazon · OA