Partition List - Linked List - Leetcode 86

preview_player
Показать описание


0:00 - Read the problem
1:20 - Drawing Explanation
4:45 - Coding Explanation

leetcode 86

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

I can't believe I solved this one on my own. First 13 minutes of trying to solve it I was so clueless. Then I went to play Marvel Rivals. Came back to Leetcode over an hour later and was about to look up this video, when I suddenly had the idea of 2 references for a left and right list. Decided to give it a try before watching NeetCode, and sure enough it worked. Thanks Marvel Rivals! (just kidding, thanks NeetCode!)

dm
Автор

I was trying to manipulate the pointers in the list and found it convoluted, you made the problem look like it was an easy level linked list question

ladydimitrescu
Автор

How did u make this question that easy??? Crystal clear explanation

nchou
Автор

Those who are saying that Space complexity here is O(N).Try to look into his code. If he would be using O(N) space, then he would be making new node for every iteration of while loop. but in reality he has only made 2 node which are dummy node (left, right) so overall space complexity is Constant O(1).

najmuzzamakhan
Автор

To whom who think that the above code uses extra space: An important thing to note here is that he showed the original linked list intact in the above diagrams. However, in the implementation, we remove the nodes from the original linked list and attach them in the before or after list. We don't utilize any additional space. We simply move the nodes from the original list around.

hillarioushollywood
Автор

I don't get tired of saying it's amazing. I made previous node, left node and dummy(head) node. Basically, in my first approach, I dealt with one direction way. Coming up with conditions to make it work was not easy work but wow... Just divided into two LinkedIn lists and... it's great, and explanation easy to understand. Thanks a lot. I genuinely respect your work.

licokr
Автор

If you're updating the tail variables each time in the loop, how does the "left" dummy node get updated? Like I don't understand how you just returned "left.next" without doing anything to "left" in the while loop.

ritviklashkari
Автор

i was in a Pos where i Felt hard to do Leetcode Linked Lists (after 5medium prob) but this one put me to a comfort Zone
Thanks

tejuteja
Автор

your explanations are always the best, i view the algorithm and understand it well enough to implement myself

raghavendrac
Автор

The way you fraternizing around with your visualization notes is so immaculate, like the draws are so well organized,
Is it just good practice or do you just use hand instead of mouse

NEO-wlox
Автор

thanks for the clear explanation, was thinking to do it in-place without any additional Lists but it was really complicated, =)

mtxar
Автор

how does the dummy nodes connect to the head at the first place? Doesn't it something like left.next = head at the beginning? Not totally understand why doing ltail.next = head transfers to left

PeachHeartBlog
Автор

Heyy that was a great explanation but can u plz explain the space complexity here..

mtr
Автор

This isn't a Medium problem, but rather an Easy problem, compared to others in the Linked List category I've seen.

CST
Автор

Great videos. I really wanted someone who codes in python on youtube leetcode videos and I found you!

nandanimadhukar
Автор

What if you have to change the original list in-place? This doesnt look like constant space

ahsin.shabbir
Автор

we are creating only two new node and we are assinging its next to original linked list so space complexity is 0(1)

noob-pslr
Автор

made it very easy wasted 1 hr on my approach

ultimatecreed
Автор

Bro, please increase the audio volume while recording, its a bit low. Thanks for the great explanation like always 🙂

vishnugajulapalli
Автор

Thank you so much, your explanation is pretty simple and easy to understand. I subscribed your channel!!!
Keep it up !!!

devjeff
join shbcf.ru