Tap here to switch tabs
Problem
Submissions

Problem: Sort Vowels by Frequency

Try to solve the Sort Vowels by Frequency problem.

Statement

Given a string s, rearrange the vowels in s such that they are sorted in descending order based on their frequencies in s. Place the sorted vowels back into their original positions while keeping all consonant characters unchanged.

If multiple vowels have the same frequency, preserve their relative order of first appearance in the original string.

The vowels are 'a', 'e', 'i', 'o', and 'u'.

Constraints:

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

  • s consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Vowels by Frequency

Try to solve the Sort Vowels by Frequency problem.

Statement

Given a string s, rearrange the vowels in s such that they are sorted in descending order based on their frequencies in s. Place the sorted vowels back into their original positions while keeping all consonant characters unchanged.

If multiple vowels have the same frequency, preserve their relative order of first appearance in the original string.

The vowels are 'a', 'e', 'i', 'o', and 'u'.

Constraints:

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

  • s consists of lowercase English letters.