6-10PM challenge problem #001

akbhairwal

akbhairwal

Posted on September 24, 2019

6-10PM challenge problem #001

Move Zeros To End

An array 'arr' which have integers. You need to move all the zeros in the end of the array. You should preserve the relative order of other numbers in the array.

We should implement a solution that is more efficient than a naive brute force.

Example :
Given array arr = [12, 3, 0, 2, 8, 11, 0, 0, 6, 4, 0, 5, 7, 0, 8, 9, 0]
output: [12, 3, 2, 8, 11, 6, 4, 5, 7, 8, 9, 0, 0, 0, 0, 0, 0]

Solution

💖 💪 🙅 🚩
akbhairwal
akbhairwal

Posted on September 24, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

6-10PM challenge problem #002
challenge 6-10PM challenge problem #002

September 25, 2019

6-10PM challenge problem #001 solution
challenge 6-10PM challenge problem #001 solution

September 25, 2019

6-10PM challenge problem #001
challenge 6-10PM challenge problem #001

September 24, 2019