Back to course home
0% completed
Vote For New Content
Longest Substring Of All Vowels in Order (medium)
Problem Statement
You are given a string word that only contains English vowels: 'a', 'e', 'i', 'o', and 'u'. A substring is called beautiful if:
- It includes all five vowels at least once.
- The vowels appear in alphabetical order — meaning all 'a's come before all 'e's, then 'i's, 'o's, and finally 'u's.
Return the length of the longest beautiful substring present in the given string. If there's no such substring, return 0.
Examples
Example 1
- Input: word =
"aaeiiouuuaeioou"
- Expected Output:
9
- Explanation: The substring
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible