Remove Nth Node From End of List | 1 Pass | 2 Pass | Leetcode 19

  Рет қаралды 4,897

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 42
@aws_handles
@aws_handles 8 ай бұрын
I watched almost all your videos of Graph concepts as well as Graph Popular interview problems. I admit that no one today can teach like you 🔥
@surajsidar3280
@surajsidar3280 4 ай бұрын
I was asked this question in Amazon SDE1. The interviewer asked both solution(2 pass and 1 pass) I am commenting here so that I will see my own comment in the future.
@adamyasharma_0135
@adamyasharma_0135 Ай бұрын
was looking for a proper reason for slow and fast approach,and as always found it at the best place
@souravjoshi2293
@souravjoshi2293 8 ай бұрын
Hi MIK, I was able to solve today's gfg potd because of your comparator video you posted few days ago. just wanted to thank and appreciate you
@adarshjha5126
@adarshjha5126 8 ай бұрын
Bhaiya if you get some time then please try to make a video on yesterday biweekly problem C ...i did a lot of practice in graphs but still was not able to solve it...😢😢
@wearevacationuncoverers
@wearevacationuncoverers 8 ай бұрын
I also couldn't solve :-(
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
Definitely. Actually I am travelling this weekend. Once I get back home after 2 days, I will upload 🙏
@oqant0424
@oqant0424 8 ай бұрын
@@codestorywithMIK please upload both 3,4
@arjunrai8126
@arjunrai8126 8 ай бұрын
Pls upload​@@codestorywithMIK
@ugcwithaddi
@ugcwithaddi 8 ай бұрын
Made it simple and easy 👌🏻
@tutuimam3381
@tutuimam3381 8 ай бұрын
Amazing explanation ❤❤
@gui-codes
@gui-codes 7 ай бұрын
Thanks man. you are too good
@iWontFakeIt
@iWontFakeIt 8 ай бұрын
solved it on my own
@gauravbanerjee2898
@gauravbanerjee2898 8 ай бұрын
Thank you so much bhaiya ❤❤
@dayashankarlakhotia4943
@dayashankarlakhotia4943 8 ай бұрын
var RemoveNthFromEnd=function(head,n){ let fast=head,slow=head; for(let i=0;i
@daniel-so7cv
@daniel-so7cv 8 ай бұрын
bhai konsa college se ho
@dayashankarlakhotia4943
@dayashankarlakhotia4943 8 ай бұрын
purima university Jaipur
@EB-ot8uu
@EB-ot8uu 8 ай бұрын
awesome as always
@maheshkeshwala62
@maheshkeshwala62 8 ай бұрын
Bro can you please upload question 3 and 4 of leetcode contest every week it will be so helpful
@pragatigoyal4015
@pragatigoyal4015 7 ай бұрын
i dont see deleing in c#, can you please explain if assigning next element automatically release the unwanted object in c#
@arjunju469
@arjunju469 8 ай бұрын
wil u make the today leetcode contest video ??
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
Definitely. Actually I am travelling this weekend. Once I get back home after 2 days, I will upload 🙏
@DevOpskagyaan
@DevOpskagyaan 8 ай бұрын
Kitna simple bana dete ho bhai qn ko. Matlab beijjati hojati hai qn ki 😂
@AdityaGupta-zd5sq
@AdityaGupta-zd5sq 8 ай бұрын
sir please contest related video banaaiye
@wearevacationuncoverers
@wearevacationuncoverers 8 ай бұрын
I also did with one more approach. Reverse the node delete nth node reverse it back class Solution { public: ListNode* reverseList(ListNode* head) { ListNode* prev = nullptr; ListNode* current = head; ListNode* next = nullptr; while (current != nullptr) { next = current->next; current->next = prev; prev = current; current = next; } return prev; } ListNode* removeNthFromEnd(ListNode* head, int n) { if (head == nullptr || n next; } // If the node to be removed is the first node if (prev == nullptr) { head = current->next; } else { prev->next = current->next; } // Reverse the linked list back to its original form head = reverseList(head); return head; } };
@2110__NishantThakare
@2110__NishantThakare 8 ай бұрын
This solution will be 3 pass so not so optimal😊
@aws_handles
@aws_handles 8 ай бұрын
@@2110__NishantThakarecorrect. Its a 3 pass
@codeandtalk6
@codeandtalk6 8 ай бұрын
❤❤❤❤
@AmanKumar-qz4jz
@AmanKumar-qz4jz 8 ай бұрын
bhaiya agar aap live biweekly or weekly leetocode contest solve karoge toh bhut fayda hoga
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
Definitely. Actually I am travelling this weekend. Once I get back home after 2 days, I will upload 🙏
@dayashankarlakhotia4943
@dayashankarlakhotia4943 8 ай бұрын
if llsize==even then temp ==null&&llsize()==oddthen temp.next==null.
@coderletscode
@coderletscode 8 ай бұрын
Although i am doing dsa with java but language does not matter for DSA..logic is same but you should continue with java.
@infinitygaming7192
@infinitygaming7192 8 ай бұрын
bhaiya gfg ka potd le aoo
@kamranwarsi12b22
@kamranwarsi12b22 8 ай бұрын
Can we do something like first reverse the list and then traverse , will it work? 🤔
@wearevacationuncoverers
@wearevacationuncoverers 8 ай бұрын
yes I did the same. it works. But yeah, I will have to traverse the array multiple times.
@kamranwarsi12b22
@kamranwarsi12b22 8 ай бұрын
@@wearevacationuncoverers can you plz share ur code
@wearevacationuncoverers
@wearevacationuncoverers 8 ай бұрын
@@kamranwarsi12b22 sure bhai. class Solution { public: ListNode* reverseList(ListNode* head) { ListNode* prev = nullptr; ListNode* current = head; ListNode* next = nullptr; while (current != nullptr) { next = current->next; current->next = prev; prev = current; current = next; } return prev; } ListNode* removeNthFromEnd(ListNode* head, int n) { if (head == nullptr || n next; } // If the node to be removed is the first node if (prev == nullptr) { head = current->next; } else { prev->next = current->next; } // Reverse the linked list back to its original form head = reverseList(head); return head; } };
@kamranwarsi12b22
@kamranwarsi12b22 8 ай бұрын
@@wearevacationuncoverers shukriyaa 🙇‍♂️🙇‍♂️
@DevOpskagyaan
@DevOpskagyaan 8 ай бұрын
Wow. Thanks man
@dayashankarlakhotia4943
@dayashankarlakhotia4943 8 ай бұрын
Please change the link of leetcode
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
Done. Thank you ❤️😇
@therealsumitshah
@therealsumitshah 8 ай бұрын
Iss waale problem mei temp != NULL condition kyu chahiye bina uske bhi chal rha hai ye toh. @codestorywithmik
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 57 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 31 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3 МЛН
Coding Unbreakable Encryption in C | One-Time Pad
17:42
HirschDaniel
Рет қаралды 4,4 М.
Palindrome Linked List | 4 Approaches | Leetcode 234| codestorywithMIK
44:53