Tap here to switch tabs
Problem
Submissions

Problem: Longest Substring Of All Vowels in Order

med
30 min
Try to solve the Longest Substring Of All Vowels in Order problem.

Statement

A string is considered beautiful if it meets the following conditions:

  • It contains every one of the 55 English vowels ('a', 'e', 'i', 'o', and 'u') at least once.

  • Its characters are arranged in nondecreasing alphabetical order (that is, every 'a' occurs before any 'e', every 'e' occurs before any 'i', every 'i' occurs before any 'o', and every 'o' occurs before any 'u').

Given a string word consisting of English vowels, return the length of the longest beautiful substring in word. If no beautiful substring is present, return 00.

A substring is a contiguous sequence of characters within a string.

Constraints:

  • 1≤1 \leq word.length ≤5×105\leq 5 \times 10^5

  • word consists of characters 'a', 'e', 'i', 'o', and 'u'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Substring Of All Vowels in Order

med
30 min
Try to solve the Longest Substring Of All Vowels in Order problem.

Statement

A string is considered beautiful if it meets the following conditions:

  • It contains every one of the 55 English vowels ('a', 'e', 'i', 'o', and 'u') at least once.

  • Its characters are arranged in nondecreasing alphabetical order (that is, every 'a' occurs before any 'e', every 'e' occurs before any 'i', every 'i' occurs before any 'o', and every 'o' occurs before any 'u').

Given a string word consisting of English vowels, return the length of the longest beautiful substring in word. If no beautiful substring is present, return 00.

A substring is a contiguous sequence of characters within a string.

Constraints:

  • 1≤1 \leq word.length ≤5×105\leq 5 \times 10^5

  • word consists of characters 'a', 'e', 'i', 'o', and 'u'.