aboutsummaryrefslogtreecommitdiff
path: root/other/reverse_vowel_string.rs
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
committerJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
commita96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch)
treee2a2b3f49f9fb741be81415266ac93e74cff42ec /other/reverse_vowel_string.rs
parent694ad5ed71edcb1deccab54b72d706b779918276 (diff)
downloadleetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz
leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/reverse_vowel_string.rs')
-rw-r--r--other/reverse_vowel_string.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/other/reverse_vowel_string.rs b/other/reverse_vowel_string.rs
deleted file mode 100644
index 4ae282d..0000000
--- a/other/reverse_vowel_string.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-struct Solution;
-
-impl Solution {
- pub fn reverse_vowels(s: String) -> String {
- let (mut i, mut j) = (0, s.len().checked_sub(1).unwrap_or(0));
- let mut cs = s.chars().collect::<Vec<char>>();
- while i < j {
- if !Self::is_vowel(cs[i].to_ascii_lowercase()) {
- i += 1;
- continue
- }
- if !Self::is_vowel(cs[j].to_ascii_lowercase()) {
- j -= 1;
- continue
- }
- cs.swap(i, j);
- i += 1;
- j -= 1;
- }
- cs.iter().collect()
- }
- fn is_vowel(c: char) -> bool {
- match c {
- 'a' | 'e' | 'i' | 'o' | 'u' => true,
- _ => false
- }
- }
-}
-
-fn main() {
- let s = "hello".to_string();
- print!("{}", Solution::reverse_vowels(s));
-}