2019-11-10 LeetCode in Rust LeetCode 1089. Duplicate Zeros Problem Statement impl Solution { pub fn duplicate_zeros(arr: &mut Vec<i32>) { let n = arr.len(); let mut j = n; for i in 0..n { if arr[i] == 0 { j += 1; } } let mut i : i32 = (n - 1) as i32; while i >= 0 { j -= 1; if j < n { arr[j] = arr[i as usize]; } if arr[i as usize] == 0 { j-= 1; if j < n { arr[j] = 0; } } i -= 1; } }} Newer LeetCode 1088. Confusing Number II Older LeetCode 1091. Shortest Path in Binary Matrix