Trailing zeroes and collection searching

As I've decided early in the beginning, this blog will contain all the stories that I find valuable to share from my journey into IT / engineering world. Therefore today I'll try to showcase a couple of tasks I recently encountered during one of my tech interviews.

Fine, without further ado let's jump to the first one:

Write a function which takes an array of numbers as an input and processes it in such a way that the array returned will have all zeroes (if there were any) moved to the end of it

I usually prefer to start off with an outline of how everything might work, like a short step-by-step execution of an algorithm, so here is what I came up with: Example 1.jpg

Main points