Skip to content

Commit aec9d59

Browse files
committed
solved: 283
1 parent 8a56aa4 commit aec9d59

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

code/283.move-zeroes.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @leet start
2+
impl Solution {
3+
pub fn move_zeroes(nums: &mut Vec<i32>) {
4+
let mut i = 0;
5+
let mut j = 0;
6+
while j < nums.len() {
7+
if nums[j] != 0 {
8+
nums.swap(i, j);
9+
i += 1;
10+
}
11+
j += 1;
12+
}
13+
}
14+
}
15+
// @leet end

0 commit comments

Comments
 (0)