345. Reverse Vowels of a String Easy

@problem@discussion
#Two Pointers#String



1/**
2 * [345] Reverse Vowels of a String
3 *
4 * Given a string s, reverse only all the vowels in the string and return it.
5 * The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases.
6 *  
7 * Example 1:
8 * Input: s = "hello"
9 * Output: "holle"
10 * Example 2:
11 * Input: s = "leetcode"
12 * Output: "leotcede"
13 *  
14 * Constraints:
15 * 
16 * 	1 <= s.length <= 3 * 10^5
17 * 	s consist of printable ASCII characters.
18 * 
19 */
20pub struct Solution {}
21
22// problem: https://leetcode.com/problems/reverse-vowels-of-a-string/
23// discuss: https://leetcode.com/problems/reverse-vowels-of-a-string/discuss/?currentPage=1&orderBy=most_votes&query=
24
25// submission codes start here
26
27impl Solution {
28    pub fn reverse_vowels(s: String) -> String {
29        String::new()
30    }
31}
32
33// submission codes end
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38
39    #[test]
40    fn test_345() {
41    }
42}
43


Back
© 2025 bowen.ge All Rights Reserved.