Move all zeros present in the array to the end

Given an array of integers, move all zeros present in the array to the end. The solution should maintain the relative order of items in the array.

Example Solution

When the solution is called with the following input arr = [6 0 8 2 3 0 4 0 1] it is expected to return the array [6, 8, 2, 3, 4, 1, 0, 0, 0].

Contributed by Murat Sütunç