Skip to content

Commit e6066bf

Browse files
committed
Create: 0344-reverse-string.rs
1 parent ee7a3bc commit e6066bf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

rust/0344-reverse-string.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
impl Solution {
2+
pub fn reverse_string(s: &mut Vec<char>) {
3+
let (mut left, mut right) = (0, s.len() - 1);
4+
5+
while left < right {
6+
s.swap(left, right);
7+
left += 1;
8+
right -= 1;
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)