Solving LeetCode 283 in JavaScript (Move Zeroes)

preview_player
Показать описание
In this video I solve LeetCode problem 283 (Move Zeroes) with the JavaScript programming language. This question has previously appeared during Facebook coding interviews.

I start by helping you understand what the problem is asking for, then I will go over the pseudo-code/logic for a solution, and finally I will write the solution code explaining each line, step-by-step.

Using my simple and easy-to-understand methodology, I make difficult and complex interview questions *incredibly* easy to understand. So easy in fact, that even your grandma could do it! 👵🏻

I will be solving a new problem EVERY WEEK, so be sure to smash that subscribe button and hit the notification bell so you don't miss a single one! 😀

-----
I also offer full-length interview preparation courses, programming tutorials, and even 1-1 tutoring!

Who knew acing your next software engineering interview could be *so* incredibly easy!

-----
#programming #codinginterview #leetcode
Рекомендации по теме
Комментарии
Автор

By far the simplest and easiest solution that I've seen. Thanks!

nishantscollectibles
Автор

Great videos. Please upload more, there's not enough JavaScript Leetcode content out there!

dtwelve
Автор

Great video! But perhaps a simpler solution might look like this:

var moveZeroes = function(nums) {
for(let i = 0; i < nums.length; i++){
if(nums[i] === 0){
nums[nums.length - 1] = nums.splice(i, 1)
}
}
};

This will only require one loop. If anyone can see any issues with this solution at scale please let me know.

garrettsapps
Автор

Clearly explained, brief and to the point

ykangho
Автор

Very quick, very straight forward. Thank you so much.

mmbower
Автор

When you replace the non 0 number you can switch the number its replacing vs looping through at the end

clementebri
Автор

Do you teach online JavaScript leetcode algorithms

roopabs
Автор

what if you're dealing with booleans. would it not just convert them to zeros same with empty arrays?

hyit
Автор

How can I know the time complexity of any algorithm?

andreshernandez
welcome to shbcf.ru