🌐
LeetCode
leetcode.com › problems › reverse-vowels-of-a-string
Reverse Vowels of a String - LeetCode
Reverse Vowels of a String - Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once.
🌐
AlgoMonster
algo.monster › liteproblems › 345
345. Reverse Vowels of a String - In-Depth Explanation
In-depth solution and explanation for LeetCode 345. Reverse Vowels of a String in Python, Java, C++ and more. Intuitions, example walk through, and complexity analysis. Better than official and forum solutions.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › reverse-vowels-given-string
Reverse vowels in a given string - GeeksforGeeks
March 17, 2025 - Input: "programming" Output: "prigrammong" Explanation: The vowels 'o', 'a', 'i' are reversed, resulting in "prigrammong". ... The idea is to extract all vowels from the given string s and store them in vowelStr while maintaining their order.
🌐
Medium
medium.com › repeat-code-with-leetcode › repeat-code-with-leetcode-reverse-vowels-of-a-string-8871e74a980d
Repeat Code With LeetCode — Reverse Vowels Of A String | by Evan SooHoo | Repeat Code With LeetCode | Medium
May 23, 2024 - The vowels are 'a', 'e', 'i', 'o', ... more than once. ... “Reverse Words In A String” is a LeetCode medium, with both a clever two pointer technique solution and a fairly straightforward stack solution....
🌐
GitHub
github.com › doocs › leetcode › blob › main › solution › 0300-0399 › 0345.Reverse Vowels of a String › README_EN.md
leetcode/solution/0300-0399/0345.Reverse Vowels of a String/README_EN.md at main · doocs/leetcode
class Solution: def reverseVowels(self, s: str) -> str: vowels = "aeiouAEIOU" i, j = 0, len(s) - 1 cs = list(s) while i < j: while i < j and cs[i] not in vowels: i += 1 while i < j and cs[j] not in vowels: j -= 1 if i < j: cs[i], cs[j] = cs[j], cs[i] i, j = i + 1, j - 1 return "".join(cs) class Solution { public String reverseVowels(String s) { boolean[] vowels = new boolean[128]; for (char c : "aeiouAEIOU".toCharArray()) { vowels[c] = true; } char[] cs = s.toCharArray(); int i = 0, j = cs.length - 1; while (i < j) { while (i < j && !vowels[cs[i]]) { ++i; } while (i < j && !vowels[cs[j]]) { --j; } if (i < j) { char t = cs[i]; cs[i] = cs[j]; cs[j] = t; ++i; --j; } } return String.valueOf(cs); } }
Author   doocs
🌐
YouTube
youtube.com › watch
Reverse Vowels of a String - LeetCode 345 - Python ...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
Rishabh1403
rishabh1403.com › posts › coding › leetcode › 2020 › 05 › leetcode-reverse-vowels-of-a-string
Leetcode | Solution of Reverse Vowels of a String in JavaScript | Rishabh Jain
We iterate over the string and check if the characters at both indices are vowels. In case it is, we swap them and move on with the loop. At last, we join back the array and return it.
🌐
Medium
onyxwizard.medium.com › leetcode-reverse-vowels-of-a-string-6e9043ed0bcb
Leetcode : Reverse Vowels of a String | by Onyx | Medium
January 31, 2025 - Leetcode : Reverse Vowels of a String Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and …
Find elsewhere
🌐
Educative
educative.io › answers › leetcode-reverse-vowels-of-a-string
LeetCode: Reverse Vowels of a String
It finds and swaps the leftmost and rightmost vowels, moving the pointers inward. This continues until the pointers cross each other. Time complexity is O(n) for a single traversal; space complexity is O(1) due to a single temporary variable.
🌐
YouTube
youtube.com › kevin naughton jr.
Reverse Vowels of a String - YouTube
For business inquiries email partnerships@k2.codes Discord: bit.ly/K2-discord
Published   September 30, 2019
Views   26K
🌐
LeetCode-in-Java
leetcode-in-java.github.io › src › main › java › g0301_0400 › s0345_reverse_vowels_of_a_string
LeetCode-in-Java | Java-based LeetCode algorithm problem solutions, regularly updated.
The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases. ... public class Solution { private boolean isVowel(char c) { return c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U'; } public String reverseVowels(String str) { int i = 0; int j = str.length() - 1; char[] str1 = str.toCharArray(); while (i < j) { if (!isVowel(str1[i])) { i++; } else if (!isVowel(str1[j])) { j--; } else { // swapping char t = str1[i]; str1[i] = str1[j]; str1[j] = t; i++; j--; } } return String.copyValueOf(str1); } }
🌐
edSlash
edslash.com › home › leetcode challenge #345. reverse vowels of a string
LeetCode Challenge #345. Reverse Vowels of a String - edSlash
November 28, 2023 - 4. After swapping, just increase ‘ i ‘ by ( i++) decrease ( j – -) The loop continues until ‘i’ is incremented and ‘j’ is decremented to continue searching for other pairs of vowels. And it will run until ‘ i ‘ is no longer less than ‘j’ which means all the possible pairs or vowels have been swapped. 5. finally we will come outside the loop and the string ‘ s’ is returned .
🌐
Medium
luqmanshaban.medium.com › solving-the-reverse-vowels-leetcode-challenge-step-by-step-guide-838ada83acaf
Reverse Vowels of a String. Explore a detailed step-by-step guide… | by Luqman Shaban | Medium
August 13, 2023 - We are tasked with reversing the ... transformed to 'holle'. Similarly, if the string has the value 'leetcode', it should be changed to 'leotcede'....