Reverse Linked List | Merge Two Sorted Lists | Reverse Order | Leetcode 206 | Leetcode 21 | GFG POTD

  Рет қаралды 7,626

codestorywithMIK

codestorywithMIK

Күн бұрын

Whatsapp Community Link : www.whatsapp.c...
This is the 18th Video on our playlist "Linked List : Popular Interview Problems".
In this video we will try to solve 3 very famous Linked List problems -
Reverse Linked List (Leetcode 206)
Merge Two Sorted Lists (Leetcode 21)
Merge 2 sorted linked list in reverse order (GFG)
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.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Reverse Linked List | Merge Two Sorted Lists | Merge 2 sorted linked list in reverse order
Company Tags : Google, Amazon, D.E. Shaw , Microsoft
My solutions on Github(C++ & JAVA) : github.com/MAZ...
github.com/MAZ...
github.com/MAZ...
GfG Link : www.geeksforge...
Leetcode Link : leetcode.com/p...
Leetcode Link : leetcode.com/p...
My DP Concepts Playlist : • Roadmap for DP | How t...
My Graph Concepts Playlist : • Graph Concepts & Qns -...
My GitHub Repo for interview preparation : github.com/MAZ...
Subscribe to my channel : / @codestorywithmik
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
#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 #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear

Пікірлер: 23
@noextrasugar
@noextrasugar 22 күн бұрын
I'm coming from video #12 of your Recurion concepts playlist and thought 'Hmmm, let's try reversing LL by myself before watching this video.' And my solution was accepted on the first try. I was feeling so confident before submitting (after correcting some minor syntax issues). Recursive leap of faith is the key guys
@codestorywithMIK
@codestorywithMIK 22 күн бұрын
Indeed “Recursion leap of faith”🙌
@de_coder1
@de_coder1 10 ай бұрын
So can we expect daily GFG potd as well?😃
@aws_handles
@aws_handles 10 ай бұрын
How do you manage your time bro . Hats off 🙏🏻🔥
@wearevacationuncoverers
@wearevacationuncoverers 10 ай бұрын
Thanks a lot for your hard work.
@EB-ot8uu
@EB-ot8uu 8 ай бұрын
loved the explanation
@DevOpskagyaan
@DevOpskagyaan 10 ай бұрын
Thank you 🙏🏻
@gauravbanerjee2898
@gauravbanerjee2898 10 ай бұрын
Thanks a lot bhaiya ❤❤
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Most welcome ❤️
@tutuimam3381
@tutuimam3381 10 ай бұрын
Thanks a lot 👍
@thekindspill
@thekindspill 10 ай бұрын
Thank you MIK
@molyoxide8358
@molyoxide8358 8 ай бұрын
Bro Linked List ko reverse karne ka yeh wla code dekhna pls : - ListNode* reverseList(ListNode* head) { ListNode* curr = head, *prev=NULL; while(curr != NULL) { swap(curr->next, prev); swap(prev, curr); } return prev; }
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
That’s absolutely correct and concise code. It will work .
@molyoxide8358
@molyoxide8358 8 ай бұрын
@@codestorywithMIK Bro If U can create a story around this code It would be really helpful.
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
@@molyoxide8358 Mmm, actually it's a short code but hope it helps. The main responsibility of curr is to tell us where exactly you are standing. And prev tells us the node previous to curr. Now, as we start, curr is head and since there is no previous to head, so prev = NULL. Now, the main work we have to do is, as curr moves ahead, we have to make curr point to it's prev node instead of next node. So, we do it by swap(curr->next, prev); -> This lines makes the curr point to it's previous node. Note that here, curr's next value is changed only but curr is still at the same node. Also note that, prev has now got the value of old curr->next value (where we have to move ahead now) ----> Point-1 Now, as we move ahead, we have to ensure that curr should move ahead . How to move curr further ? See Point-1 above, prev already has that value. So assign curr = prev and prev should now become curr (hence we wrote swap(prev, curr); to achieve that) Hope this helps
@molyoxide8358
@molyoxide8358 8 ай бұрын
​@@codestorywithMIK Bhaiya itne acche explanation dene ke liye SHUKRIYA.
@anuppatankar4294
@anuppatankar4294 10 ай бұрын
Great video 👌🏻
@ArjunSaxena-wl3qs
@ArjunSaxena-wl3qs 8 ай бұрын
I could figure point the 3 pointer one, just by listening to your story of 5 minutes
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
❤️❤️🙏🙏
@rishabh1406
@rishabh1406 10 ай бұрын
Please solve single number 3 . Leetcode 260
@shivammaurya5464
@shivammaurya5464 10 ай бұрын
Ap na Java mein bhi code provide kare
@shivanshgaur3475
@shivanshgaur3475 2 ай бұрын
gfg wale solution segmentation falt aa rha h last k 5 cases mein
@tarunpatel1457
@tarunpatel1457 Ай бұрын
write iterative
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 6 МЛН
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН
L23. Merge two sorted Linked Lists
18:55
take U forward
Рет қаралды 71 М.
Programming Languages Tier List 2024
16:18
Neal Wang
Рет қаралды 11 М.
Lecture 49: Merge 2 Sorted Linked Lists || Sort 0s, 1s and 2s in Linked List
58:44
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 246 М.
Top 5 Data Structures they asked me in 127 interviews
8:01
Sahil & Sarra
Рет қаралды 150 М.
L25. Merge K Sorted Lists | Multiple Approaches
30:02
take U forward
Рет қаралды 52 М.
Knuth-Morris-Pratt KMP String Matching Algorithm | Search Pattern | GFG POTD
1:05:36
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 6 МЛН