Tap here to switch tabs
Problem
Submissions

Problem: Sort Vowels in a String

med
30 min
Try to solve the Sort Vowels in a String problem.

Statement

Given a string s, rearrange the characters such that all vowels are sorted in nondecreasing order by their ASCII values, while all consonants remain in their original positions.

Return the resulting string.

Note: The vowels are 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', and 'U'. All other English letters are considered consonants.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of letters of the English alphabet in uppercase and lowercase.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Vowels in a String

med
30 min
Try to solve the Sort Vowels in a String problem.

Statement

Given a string s, rearrange the characters such that all vowels are sorted in nondecreasing order by their ASCII values, while all consonants remain in their original positions.

Return the resulting string.

Note: The vowels are 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', and 'U'. All other English letters are considered consonants.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of letters of the English alphabet in uppercase and lowercase.