Practice Longest Substring Of All Vowels in Order
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Find the longest contiguous part of word that contains each vowel a, e, i, o, u at least once, with all letters in nondecreasing alphabetical order. Return its length, or 0 if none exists. word contains only those vowels.
Source: Longest Substring Of All Vowels in Order on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
word = "aeiaaioaaaaeiiiiouuuooaauuaeiu"
Output
13
# Example 2
Input
word = "aeeeiiiioooauuuaeiou"
Output
5
# Example 3
Input
word = "a"
Output
0
Constraints
1 <= word.length <= 5 * 10^5
word consists of characters 'a', 'e', 'i', 'o', and 'u'.
Related LeetCode Problems
Practice more problems similar to Longest Substring Of All Vowels in Order.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.