pyassistant

Move Zeros to End

Given a list of integers, write a function to move all zeros to the end of the list while maintaining the relative order of the non-zero elements.

Example:

Input:
[0, 1, 0, 3, 12]
Output:
[1, 3, 12, 0, 0]

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.