diff --git a/problems/0283.移动零.md b/problems/0283.移动零.md index 4d8fd9a1..cbce0295 100644 --- a/problems/0283.移动零.md +++ b/problems/0283.移动零.md @@ -169,7 +169,20 @@ void moveZeroes(int* nums, int numsSize){ } ``` - +### Rust +```rust +impl Solution { + pub fn move_zeroes(nums: &mut Vec) { + let mut slow = 0; + for fast in 0..nums.len() { + if nums[fast] != 0 { + nums.swap(slow, fast); + slow += 1; + } + } + } +} +```