|Move all zeroes in an array to the end while maint...|General Coding Problems

fn move_zeroes(arr: &mut [i32])

Medium

Move all zeroes in an array to the end while maintaining the order of non-zero elements.

fn move_zeroes(arr: &mut [i32])

Asked in

accenture

Examples

Example 1:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Example 2:
Input: [0,0,1]
Output: [1,0,0]
Submit Result

Click Run to test sample cases, or Submit to evaluate all cases