[Java] Leetcode 1089. Duplicate Zeros [Array #5]

preview_player
Показать описание
In this video, I'm going to show you how to solve Leetcode 1089. Duplicate Zeros which is related to Array.

Here’s a quick rundown of what you’re about to learn:

⭐️ Course Contents ⭐️
⌨️ (0:00) Question
⌨️ (2:27) Solution Explain
⌨️ (8:14) Code

In the end, you’ll have a really good understanding on how to solve Leetcode 1089. Duplicate Zeros and questions that are similar to this Array.

Рекомендации по теме
Комментарии
Автор

This is the best solution I’ve seen for this question. Very well explained. Thank you!

martyk
Автор

Thank you for the solution, it's really important to utilize the data structures.
Sadly, this question demands to be solved in place and I honestly hate it. No one will come up with counting zeroes trick on an interview first time seeing the problem, they do not want problem solvers they want master of memorization.

valkon_
Автор

this solution is so beautiful thank you very much

ДимашИсабек
Автор

This makes so much sense to me. Good job Eric.

nwokolobueze
Автор

This was the best solution. Surprised as you were only one I saw use this implementation.

akoboyd
Автор

Best understandable and easiest solution. Big thanks

frankf
Автор

But why do we need this solution if the task could be solved in O(1) memory

spemovie
Автор

That's a smart way to solve it! Thanks!

osamaalsalman
Автор

That's true that it's kinda hard to bring up 2pointer at interview, I like your solution way better, thanks !

mingyueliu
Автор

I was trying to do something similiar with variables but using a queue is really smart! Thanks a lot. Do you think I can solve it by storing the to-be-shifted elements into an array?

edavar
Автор

You shouldn't need to use another data structure for this. just use the same array and shift the last elements out of place.

snowglider
Автор

Good solution but this violates the constraints of the problem to solve in-place.

dk--
Автор

need to be in-place, so queue is not optimal

sase
Автор

nicely explained, could've emphasized a bit more on the coding part though

shubhamkumar-gwvb
visit shbcf.ru