Interview Query

Move Zeros Back

5
Have you seen this question before?

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]
Next question: Buy or Sell
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code