Connection node is basically a storage for the node after which the reversal happens. We want this variable to connect the constant unchanged part of the list to the partially reversed list. If the start of the reversal is from position 1, then connection remains null (connection = prev and prev = null if m= 1) In this case we connect the end left end of the reversed list to head( assuming m=1 and n = 4 4 -3 ->2 ->1 ->X 5 , head points to 1. But our new head should start at 4. So we make the new head = prev (keeps track of the first node of the reversed list) As for the tail node we see that 1-> is not connected to 5 ( whose address now is pointed by current node ) so we make tailNode (which was pointing to 1 ) point to the currentNode which is 5
He's still teaching it I guess. Although he's unknowingly enforcing the idea that people who write solutions for such problems know each line and each corner case from the get-go, which I'm sure is not the case.
you gotta explain it on pen and paper instead of jumping on the code, else nice video keep it up :)
I figured out everything except the last 4 lines. Came here for help. Thank you king 🙏
Connection node is basically a storage for the node after which the reversal happens. We want this variable to connect the constant unchanged part of the list to the partially reversed list. If the start of the reversal is from position 1, then connection remains null (connection = prev and prev = null if m= 1) In this case we connect the end left end of the reversed list to head( assuming m=1 and n = 4
4 -3 ->2 ->1 ->X 5 , head points to 1. But our new head should start at 4. So we make the new head = prev (keeps track of the first node of the reversed list)
As for the tail node we see that 1-> is not connected to 5 ( whose address now is pointed by current node ) so we make tailNode (which was pointing to 1 ) point to the currentNode which is 5
I tried many times in this method, but cannot solve bugs, thanks!!!!! you really help!
After watching Walter white now I am watching Nick White. Don't know which is the best carrier option.
well one is dead and one isnt, easy guess
I was just about to give up, but they I saw your video, thanks a lot.
How do I visualize this in my head?
you just memorised the algorithm!
So
He's still teaching it I guess. Although he's unknowingly enforcing the idea that people who write solutions for such problems know each line and each corner case from the get-go, which I'm sure is not the case.
This guy has become more and more unreliable , I suggest other better explanations from Neetcode or Techdose.
Yo if you dont understand dont blame others
Keepdoing hardwork oneday you will bee going to reach 1 million subscribers
Jonnalagadda Gopi krishna that’s the goal
@@NickWhite Godly name
@@shashank4577 ikr
a little bit hard explanation, but I got it :)
it is failing for [3,5] m=1,n=2
thanks bro .....many times
Nice Nick
great help
Awesome.
This sol is lit af
Great video..
a lot of Indian guys in comments including me
please don't clap every time you start video. It's annoying. Nice videos.
@@Godsu0417 agreed
😂😂