Interview Query

Move Zeros Back

Start Timer

0:00:00

Upvote
17
Downvote
Save question
Mark as completed
View comments (46)
Next question

Given an array of integers, write a function move_zeros_back that moves all zeros in the array to the end of the array. If there are no zeros, return the input array.

Example:

Input:

array = [0,5,4,2,0,3]
def move_zeros_back(array) -> [5,4,2,3,0,0]
.
.
.
.
.


Comments

Loading comments