Tap here to switch tabs
Problem
Ask
Submissions

Problem: Reverse Vowels of a String

easy
15 min
Explore how to apply the two pointers approach to reverse vowels in a string, including both lowercase and uppercase vowels. Understand the problem constraints, implement an efficient solution, and practice with a coding playground to reinforce your skills.

Statement

Given a string s, reverse only the vowels in the string and return the resulting string.

The vowels are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’, and they can appear in both lowercase and uppercase, potentially more than once.

Constraints:

  • 1 ≤ s.length ≤ 3 × 105

  • s consists of printable ASCII characters.

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Reverse Vowels of a String

easy
15 min
Explore how to apply the two pointers approach to reverse vowels in a string, including both lowercase and uppercase vowels. Understand the problem constraints, implement an efficient solution, and practice with a coding playground to reinforce your skills.

Statement

Given a string s, reverse only the vowels in the string and return the resulting string.

The vowels are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’, and they can appear in both lowercase and uppercase, potentially more than once.

Constraints:

  • 1 ≤ s.length ≤ 3 × 105

  • s consists of printable ASCII characters.