Loading...
Loading...
Loading...
A stock sheet has zeros where an item is out of stock. Move all zeros to the end in place, keep the order of the other counts, and print the list.
Example
Input
0 1 0 3 12
Output
1 3 12 0 0
Try the problem first. Open one hint at a time.
Keep a write index for the next non-zero value.
Swap each non-zero value with the cell at the write index.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor