Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bff5ec7

Browse files
solve: 283. Move Zeroes in rustlang
Signed-off-by: rajput-hemant <rajput.hemant2001@gmail.com>
1 parent 5e750cb commit bff5ec7

File tree

1 file changed

+15
-0
lines changed

1 file changed

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /