How to Get Better at Coding Interviews

July 18, 2019

“I learned that when you can turn a presentation into a conversation, you have won the battle of converting a client; and second, I learned that the real Carla was my best competitive weapon and my key personal advantage.”
- Carla Harris

Day 44: Zeros to the End

Be sure to mark this as completed at AlgoDaily to get on the leaderboard!

Write a method that moves all zeros in an array to its end. You should maintain the order of all other elements. Here's an example:

zerosToEnd([1, 0, 2, 0, 4, 0])
// [1, 2, 4, 0, 0, 0]

And another one:

zerosToEnd([1, 0, 2, 0, 4, 0])
// [1, 2, 4, 0, 0, 0]

Fill in the following function signature:

function zerosToEnd(nums) {

Can you do this without instantiating a new array?

Have you seen this question before? We may have updated the order. Change the day that you're on in the settings panel!

View solution →

As always, you can see the solution and a full step by step explanation at this link. Having trouble with this question? Click here to ask the community for help.

AlgoDaily Listens

Do you have any questions about the problem or AlgoDaily? Any feedback that you have for us, or any features that you'd like to see?

Respond directly to this email! AlgoDaily is proudly a one-man side project with some help from some offshore friends. I read every email, comment, or suggestion that comes in, and would love to know what's on your mind.

One last thing-- if you liked this email, and found value in it, could you kindly forward it to a friend who might benefit? Our mission is to make tough technical interviews accessible to all, including non-traditional CS backgrounds, bootcamp grads, and self taught developers. I'd deeply appreciate your help in spreading the word!


Sign up for our newsletter list and join others to get lessons and daily coding challenges sent to your inbox!