Reverse Linked List II | Clean Approach | Dry Run | MICROSOFT | Leetcode - 92 | codestorywithMIK

preview_player
Показать описание
This is the 17th Video on our Linked List Playlist.
In this video we will try to solve a very very famous Linked List Problem - Reverse Linked List II (Leetcode-92).

Trust me, this will no longer be a Medium Problem.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.

Problem Name : Reverse Linked List II
Company Tags : MICROSOFT

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook
Рекомендации по теме
Комментарии
Автор

even though i solved it on my own today, i wasnt satisfied with my solution. So came here to watch as usual and learnt so many new things! Thank you sir!

tsukuruuu
Автор

Bhai thanks a lot
Tum normal Hindi language me itna achha samjha dette ho baki log sirf eng jhaadte rhte h simple si cheez ko complex bna dette h

Abhay
Автор

Solved By My OWN wand learnt a new way from your video explanation thank you bhaiya 😀

GeniusOG
Автор

Thanks to these last few link list questions and you explanation I was able to solve today's daily on my own.

Aryan_Singh
Автор

solved on my own but i didn't use dummy node. I knew how they work but didn't know when to use them hence my code is complicated.Thanks you bhai for explaining it


class Solution {
public:
ListNode* reverseBetween(ListNode* head, int left, int right) {
int count = right - left + 1;
if(count == 1){
return head;
}
left = left-1;
ListNode*curr = head;
ListNode *temp1 = head;
while(curr && left){
temp1 = curr;
curr = curr->next;
left--;
}
ListNode *temp2 = curr;

ListNode * prev = NULL;
ListNode *next = NULL;

while(curr && count){
next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
count--;
}

if(temp1 == temp2){
temp2->next = curr;
return prev;
}
else{
temp2->next = curr;
temp1->next = prev;
}
return head;
}
};

dhairyachauhan
Автор

I knew your approach will be the cleanest. Loved the way you build from diagram to code. Thanks a lot

thekindspill
Автор

You are just Fantastic and such a powerful teacher 🔥🔥🔥

ugcwithaddi
Автор

Hats off to the unique way you make things simple.
Loved the diagram approach for Linked List problems. It helped me in other problems as well.

wearevacationuncoverers
Автор

❤ thanxx sir , ,me kbhi bhi question me stuck hota hu toh yhi aata hu

aInvincibleProgramer
Автор

Big Big Fan of your teaching style Sir

AlishaKhan-wwio
Автор

You thought us in a very simpler manner....Thank you so much 😊👏🙏

MounikaEMB
Автор

Really good explanation. Best video on this problem. Keep doing such a good work

susmitapatil
Автор

Bro do you remember me?( the REMAINDER guy).
I have been constantly asking you this question since February. But by god's grace LC pulled this on daily challenge so that you could solve & present to me.

manimanohar_
Автор

My approach was to detach the part of the linked list from left to right pass it to a new function to reverse it and then attach it back to the original list. Will this work in an interview? Considering that Time and Space complexity were same as your solution.

sarthakyadav
Автор

Hi. Thank you for your explanation. I think we can solve this problem by using the reverse function of the singly linklist, just need to paas the left associated node and make the next of right associated node NULL. After reversing it, connect it with the required nodes. What's your take on this?

manaskhare
Автор

Hi like you have started with linkedlist right now
Can you tell me which data structure you will start after this

BenJasper-ux
Автор

Sir pls make a dsa batch so that beginners will get full guidance from u and can study from basic to advanced dsa with stories

Tejaswi-xdre
Автор

loved the way of explanation bro. amazed ❣

souravjoshi
Автор

Sir one doubt problem description me niche likha h could you do it in one pass ? But apke approach me hmne do baar for loop lgaya h kya ise ek baar me hi nhi kr skte?

AshutoshEE-
Автор

15:07 mai prev -> next -> next = temp (which is prev -> next which is b), toh prev -> next -> next should be d naa???? Since prev -> next c hogaya hai toh uska next d hoga naa??? C kaise hua??? I am really confused

kondkartauqeer