Skip to content

Commit

Permalink
Create: 0344-reverse-string.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
AkifhanIlgaz committed Jan 6, 2023
1 parent ee7a3bc commit e6066bf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rust/0344-reverse-string.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
impl Solution {
pub fn reverse_string(s: &mut Vec<char>) {
let (mut left, mut right) = (0, s.len() - 1);

while left < right {
s.swap(left, right);
left += 1;
right -= 1;
}
}
}

0 comments on commit e6066bf

Please sign in to comment.