L4. Reverse a DLL | Multiple Approaches

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • Problem Link: tinyurl.com/mw45vuf6
    Entire LL Sheet: takeuforward.org/linked-list/...
    Check our A2Z DSA Course: takeuforward.org/strivers-a2z...
    Please do give us a like, and subscribe to us if you are new to our channel.
    Do follow us on our socials: linktr.ee/takeuforward

Komentáře • 68

  • @purushottam108
    @purushottam108 Před měsícem +15

    17:21 "And the interviewer will hire you,no worry" best part🤑🤑🥰🥰

  • @qihse1531
    @qihse1531 Před 8 měsíci +20

    This simple problem is insanely hard to me...thank you Striver!!

  • @aravindsagar9433
    @aravindsagar9433 Před 2 měsíci +13

    instead of using next ad back which is a bit ambiguous you could've used next and previous ( prev ) which will be more understandable

  • @harshitgarg2820
    @harshitgarg2820 Před 8 měsíci +2

    Loved your dedication sir, completed this ques and loving this series like all others. Top-tier content🔥🔥

  • @keshavchoudhary8857
    @keshavchoudhary8857 Před 6 měsíci +6

    this type of great content cannot be found elsewhere , Excellent!!!

    • @hermionegranger7443
      @hermionegranger7443 Před 6 měsíci

      Is kunal kushwaha better or this one?

    • @Ayush37262
      @Ayush37262 Před 5 měsíci +3

      ​@@hermionegranger7443I think Striver, Kunal is more into Controversies

  • @user-jw2sz7in7x
    @user-jw2sz7in7x Před 8 měsíci +4

    you are the boss .. please make a playlist about competitive programming.

  • @Sunny-hg5oe
    @Sunny-hg5oe Před 3 měsíci +2

    Great thought of using the stacks!!!!

  • @RRR-qv1so
    @RRR-qv1so Před 8 měsíci +2

    Thank you for this amazing playlist bhaiya ❤❤

  • @shubhamanand8557
    @shubhamanand8557 Před 4 měsíci +1

    It really helps me to understand in a very easy manner.
    Thanks a lot bhaiya.

  • @shanipratapsingh916
    @shanipratapsingh916 Před dnem +1

    Thank you sir this amazing lecture 🥰

  • @ankit-jangid
    @ankit-jangid Před 6 měsíci +4

    nice explanation brother, 1 thing I'd like to advice is please use the same variable names while coding which you use while explaining, it would be helpful. Good work and your videos are great!!✌🏻😇 thanks

  • @Vvvvviieiei123
    @Vvvvviieiei123 Před 8 měsíci +1

    lecture 4 done,love u bhaiya

  • @guneeshvats46
    @guneeshvats46 Před měsícem

    Dude your lectures are amazing

  • @saitejanedunoori5451
    @saitejanedunoori5451 Před měsícem

    great work and thank you !

  • @adebisisheriff159
    @adebisisheriff159 Před 5 měsíci

    Thanks Striver!!!

  • @AmanSharma-xy1qm
    @AmanSharma-xy1qm Před 7 měsíci +2

    All the video lectures and the articles helped me a lot to gain confidence in DSA and will be helping me in the interviews. Thank you Striver bhaiya for bringing such amazing content for free.

    • @vaibhavvm4147
      @vaibhavvm4147 Před 6 měsíci

      Bro how do u approach DSA, do u first watch videos and then solve it on ur own or how?

    • @AmanSharma-xy1qm
      @AmanSharma-xy1qm Před 6 měsíci

      initially, i learn first the therory part like methods that are used in this, and i usually watch Striver's playlist of that topic , and learn the patterns of the questions then i go to leetcode and gfg and solve same patterns problems. With the approaches i learned from Striver. That's all. Hope you got this.@@vaibhavvm4147

    • @Rahul_Mongia
      @Rahul_Mongia Před 4 měsíci

      @@vaibhavvm4147 video dekh le bhai, dimag khol......., phir related ques khud try kar

  • @TON-108
    @TON-108 Před 6 měsíci

    Understood!!!
    Thank You.......

  • @BeWarrior-dw4br
    @BeWarrior-dw4br Před 6 měsíci +7

    The takeuforward website is not loading .. I'm trying to access the A2Z sheet for the last three days but it is not working.

  • @chetashreejagtap7585
    @chetashreejagtap7585 Před 7 měsíci

    thank you striver👍👍

  • @oyeesharme
    @oyeesharme Před 3 dny

    thanks bhaiya for your efforts

  • @NazeerBashaShaik
    @NazeerBashaShaik Před 3 měsíci

    Understood, thank you.

  • @user-ok6km9me6x
    @user-ok6km9me6x Před 4 měsíci

    Thank You Bhaiya.

  • @pratyushtripathi1728
    @pratyushtripathi1728 Před 6 měsíci +1

    Understood 😊

  • @YourCodeVerse
    @YourCodeVerse Před 6 měsíci

    Understood✅🔥🔥

  • @Ergoswami
    @Ergoswami Před 3 měsíci

    Completed!

  • @lifehustlers164
    @lifehustlers164 Před 7 měsíci +2

    17:20 , dream come true!!!

  • @tle964
    @tle964 Před měsícem

    nice video

  • @subee128
    @subee128 Před 8 měsíci

    Thanks

  • @karthik-varma-1579
    @karthik-varma-1579 Před 16 hodinami

    i taught of doing same approach. of changing and head and swap its pointers

  • @khalasianiket816
    @khalasianiket816 Před 22 dny

    understood ❤

  • @user-uv5or5bm2c
    @user-uv5or5bm2c Před měsícem

    Understood !!

  • @abhishekprasad010
    @abhishekprasad010 Před 2 měsíci

    Understood!

  • @rizonkumarrahi
    @rizonkumarrahi Před 8 měsíci

    Great

  • @r_uhi05
    @r_uhi05 Před 3 měsíci

    understood!

  • @harshuke5831
    @harshuke5831 Před 7 měsíci

    Understood

  • @sumitworld918
    @sumitworld918 Před 2 měsíci

    Undertood 😌

  • @gourabrajak8132
    @gourabrajak8132 Před 5 měsíci +1

    👍😊

  • @user-di7cc8jp1w
    @user-di7cc8jp1w Před 6 měsíci

    nice

  • @vishious14
    @vishious14 Před 5 měsíci

    My approach looks something like this:
    Publlic class Solution{
    public static Node reverseDLL(Node head) {
    Node p=null,curr=null,f=head;
    while(f!=null){
    p = curr;
    curr = f;
    f=f.next;
    curr.next = p;
    if(p!=null) p.prev = curr;
    }
    head = curr;
    return head;
    }
    }

  • @aaryangupta4505
    @aaryangupta4505 Před 7 měsíci +2

    if(head==NULL||head->next==NULL)
    return head;

    Node* temp = NULL;
    Node* curr = head;
    while (curr != NULL)
    {
    curr->prev = curr->next;
    curr->next = temp;
    temp=curr;
    curr = curr->prev;
    }
    return temp;

  • @Zomb-zj4ip
    @Zomb-zj4ip Před měsícem

    understooooooooooooood

  • @harshitjaiswal9439
    @harshitjaiswal9439 Před 6 měsíci

    🔥🔥🔥

  • @chiragbansod8252
    @chiragbansod8252 Před 4 měsíci

    understood

  • @user-ke7fs7ds6h
    @user-ke7fs7ds6h Před 6 měsíci

    striver is best

  • @himanshukaushik9223
    @himanshukaushik9223 Před 6 měsíci

    Bhaiya 0(1) ma bhi solution hai kya iska ??

  • @TarunKumar-km5ps
    @TarunKumar-km5ps Před 5 měsíci

    👌👌👌👌👌👌👌👌👌👌👌👌

  • @user-ud2mb7lk6q
    @user-ud2mb7lk6q Před 6 měsíci

    If we point the head to last node, the behaviour would be same as revered doubly Linked list right??? Why do we need to do these processing???

    • @techwithsam4302
      @techwithsam4302 Před 23 dny

      In that case we can't traverse in the forward direction instead we have to go backward to traverse!!

  • @UjjwalMishra-xf9un
    @UjjwalMishra-xf9un Před měsícem

    why this code is not working,, its all same just using one extra variable;
    Node* reverseDLL(Node* head)
    {
    if(head==nullptr || head->next==nullptr)return head;

    Node * current=head;
    Node *back=nullptr;
    Node *front=nullptr;
    Node *temp=nullptr;
    while(current){
    back=current->prev;
    front=current->next;
    temp=back;
    back=front;
    front=temp;
    current=current->prev;
    }
    return back->prev;
    }

  • @charuprabha9696
    @charuprabha9696 Před 26 dny

  • @varun1017
    @varun1017 Před 6 měsíci

    why this is correct and
    last=curr->prev;
    curr->prev=curr->next;
    curr->next=last;
    this is not working?
    last=curr->next;
    curr->next=curr->prev;
    curr->prev=last;

  • @user-gk4zy6bk7l
    @user-gk4zy6bk7l Před 2 měsíci

    god

  • @Rohith__Dev
    @Rohith__Dev Před 29 dny

    28-06-2024

  • @user-ns7tu5no1i
    @user-ns7tu5no1i Před měsícem

    class Solution
    {
    public:
    Node* reverseDLL(Node * head)
    {
    if(head == NULL || head->next == NULL)
    {
    return head;
    }
    Node* pichli = head;
    while(head->next != NULL)
    {
    pichli = head;
    head = head -> next;
    }
    Node*mover = head;
    mover->next = pichli;
    mover->prev = NULL;
    Node*back = mover;
    mover = mover->next;
    pichli = pichli->prev;
    while(pichli != NULL)
    {
    mover->prev = back;
    mover->next = pichli;
    back = mover;
    mover = mover->next;
    pichli = pichli->prev;
    }
    mover->next = NULL;
    mover->prev = back;
    return head;
    }
    }; this is i ve done but ur one is more intutive and easy also

  • @harshilpatel3205
    @harshilpatel3205 Před 4 měsíci

    Understood 🫡

  • @ganeshvhatkar9253
    @ganeshvhatkar9253 Před 6 měsíci

    Understood

  • @ashishpradhan6250
    @ashishpradhan6250 Před měsícem

    understood

  • @pradipkumarmukhi
    @pradipkumarmukhi Před 2 měsíci

    Understood

  • @adityapandey23
    @adityapandey23 Před měsícem

    Understood

  • @himanshidafouty347
    @himanshidafouty347 Před měsícem

    Understood

  • @firebout7675
    @firebout7675 Před 4 měsíci

    understood