L4. Reverse a DLL | Multiple Approaches

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024

Комментарии • 77

  • @qihse1531
    @qihse1531 10 месяцев назад +25

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

  • @keshavchoudhary8857
    @keshavchoudhary8857 8 месяцев назад +8

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

    • @AlwaysOntopoftheworld
      @AlwaysOntopoftheworld 8 месяцев назад +1

      Is kunal kushwaha better or this one?

    • @Ayush37262
      @Ayush37262 7 месяцев назад +5

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

  • @purushottam108
    @purushottam108 3 месяца назад +36

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

  • @aravindsagar9433
    @aravindsagar9433 4 месяца назад +23

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

  • @Sunny-hg5oe
    @Sunny-hg5oe 5 месяцев назад +4

    Great thought of using the stacks!!!!

  • @AmanSharma-xy1qm
    @AmanSharma-xy1qm 9 месяцев назад +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 8 месяцев назад

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

    • @AmanSharma-xy1qm
      @AmanSharma-xy1qm 8 месяцев назад

      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 6 месяцев назад

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

  • @shubhamanand8557
    @shubhamanand8557 6 месяцев назад +2

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

  • @MdallShahria
    @MdallShahria 10 месяцев назад +4

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

  • @shanipratapsingh916
    @shanipratapsingh916 2 месяца назад +1

    Thank you sir this amazing lecture 🥰

  • @harshitgarg2820
    @harshitgarg2820 10 месяцев назад +2

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

  • @aashwinkumar2242
    @aashwinkumar2242 11 дней назад

    i guess there is an even more optimised solution now since the link is showing time limit exceeded in this approach . i did everything the same

  • @BeWarrior-dw4br
    @BeWarrior-dw4br 8 месяцев назад +8

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

  • @karthik-varma-1579
    @karthik-varma-1579 2 месяца назад +1

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

  • @RRR-qv1so
    @RRR-qv1so 10 месяцев назад +2

    Thank you for this amazing playlist bhaiya ❤❤

  • @ankit-jangid
    @ankit-jangid 9 месяцев назад +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

  • @guneeshvats46
    @guneeshvats46 3 месяца назад

    Dude your lectures are amazing

  • @RajNamdev_19
    @RajNamdev_19 Месяц назад +1

    Understood ;)

  • @DeadPoolx1712
    @DeadPoolx1712 12 дней назад

    UNDERSTOOD;

  • @oyeesharme
    @oyeesharme 2 месяца назад

    thanks bhaiya for your efforts

  • @aaryangupta4505
    @aaryangupta4505 9 месяцев назад +3

    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;

    • @aashwinkumar2242
      @aashwinkumar2242 11 дней назад

      yup thats what i did , made it much simple to understand you have to return temp->prev

  • @nishant4595
    @nishant4595 20 дней назад

    the best!!!!

  • @pratyushtripathi1728
    @pratyushtripathi1728 8 месяцев назад +1

    Understood 😊

  • @NazeerBashaShaik
    @NazeerBashaShaik 5 месяцев назад

    Understood, thank you.

  • @artcodetravel
    @artcodetravel 8 месяцев назад +2

    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 2 месяца назад +2

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

  • @AkashGautam-k2u
    @AkashGautam-k2u 6 месяцев назад

    Thank You Bhaiya.

  • @TON-108
    @TON-108 8 месяцев назад

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

  • @chetashreejagtap7585
    @chetashreejagtap7585 9 месяцев назад

    thank you striver👍👍

  • @tle964
    @tle964 3 месяца назад

    nice video

  • @XS_01
    @XS_01 2 месяца назад

    i just swapped the data values, using two pointers as head and tail.

  • @Ergoswami
    @Ergoswami 5 месяцев назад

    Completed!

  • @khalasianiket816
    @khalasianiket816 2 месяца назад

    understood ❤

  • @himanshidafouty347
    @himanshidafouty347 3 месяца назад

    Understood

  • @YourCodeVerse
    @YourCodeVerse 8 месяцев назад

    Understood✅🔥🔥

  • @MohitKumar-o3l1u
    @MohitKumar-o3l1u 3 месяца назад

    Understood !!

  • @kartikeygupta5998
    @kartikeygupta5998 Месяц назад

    can we exchange head with with tail and tail with head

  • @gourabrajak8132
    @gourabrajak8132 7 месяцев назад +1

    👍😊

  • @YashGaneriwal-je6rh
    @YashGaneriwal-je6rh Месяц назад

    done

  • @firebout7675
    @firebout7675 6 месяцев назад

    understood

  • @striverdaaadi
    @striverdaaadi 8 месяцев назад

    striver is best

  • @r_uhi05
    @r_uhi05 5 месяцев назад

    understood!

  • @rizonkumarrahi
    @rizonkumarrahi 10 месяцев назад

    Great

  • @varun1017
    @varun1017 8 месяцев назад

    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;

  • @harshitjaiswal9439
    @harshitjaiswal9439 8 месяцев назад

    🔥🔥🔥

  • @himanshukaushik9223
    @himanshukaushik9223 8 месяцев назад

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

  • @AyushRawat-v8m
    @AyushRawat-v8m 3 месяца назад

    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

  • @TarunKumar-km5ps
    @TarunKumar-km5ps 7 месяцев назад

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

  • @Rohith__Dev
    @Rohith__Dev 3 месяца назад

    28-06-2024

  • @AkashKumarTiwary-u4b
    @AkashKumarTiwary-u4b 4 месяца назад

    god

  • @vishious14
    @vishious14 7 месяцев назад

    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;
    }
    }

  • @harshilpatel3205
    @harshilpatel3205 6 месяцев назад

    Understood 🫡

  • @UjjwalMishra-xf9un
    @UjjwalMishra-xf9un 3 месяца назад +1

    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;
    }

  • @adityapandey23
    @adityapandey23 3 месяца назад

    Understood

  • @chiragbansod8252
    @chiragbansod8252 6 месяцев назад

    understood

  • @pradipkumarmukhi
    @pradipkumarmukhi 4 месяца назад

    Understood

  • @charuprabha9696
    @charuprabha9696 2 месяца назад +1

  • @lifehustlers164
    @lifehustlers164 9 месяцев назад +2

    17:20 , dream come true!!!

  • @Vvvvviieiei123
    @Vvvvviieiei123 10 месяцев назад +1

    lecture 4 done,love u bhaiya

  • @ronakvaghela2714
    @ronakvaghela2714 Месяц назад

  • @saitejanedunoori5451
    @saitejanedunoori5451 3 месяца назад

    great work and thank you !

  • @Zomb-zj4ip
    @Zomb-zj4ip 3 месяца назад

    understooooooooooooood

  • @ashishpradhan6250
    @ashishpradhan6250 3 месяца назад

    understood

  • @adebisisheriff159
    @adebisisheriff159 7 месяцев назад

    Thanks Striver!!!

  • @abhishekprasad010
    @abhishekprasad010 4 месяца назад

    Understood!

  • @sumitworld918
    @sumitworld918 4 месяца назад

    Undertood 😌

  • @ganeshvhatkar9253
    @ganeshvhatkar9253 8 месяцев назад

    Understood

  • @harshuke5831
    @harshuke5831 10 месяцев назад

    Understood

  • @ThakurIsGeek
    @ThakurIsGeek 8 месяцев назад

    nice

  • @subee128
    @subee128 10 месяцев назад

    Thanks