L4. Reverse a DLL | Multiple Approaches

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

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

  • @purushottam108
    @purushottam108 7 месяцев назад +58

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

  • @qihse1531
    @qihse1531 Год назад +29

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

  • @keshavchoudhary8857
    @keshavchoudhary8857 Год назад +15

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

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

      Is kunal kushwaha better or this one?

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

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

  • @FaizShaikh-dt8wp
    @FaizShaikh-dt8wp 3 месяца назад +3

    You are really doing a revolutionary thing 🔥, Belive me you will definately going to have a huge audience just keep doing striver! Complete the DSA series from A to Z 🔥 before 2024 ends.

  • @harshitgarg2820
    @harshitgarg2820 Год назад +4

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

  • @MdallShahria
    @MdallShahria Год назад +6

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

  • @Noah_Ken
    @Noah_Ken 9 месяцев назад +7

    Great thought of using the stacks!!!!

  • @AmanSharma-xy1qm
    @AmanSharma-xy1qm Год назад +3

    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 Год назад

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

    • @AmanSharma-xy1qm
      @AmanSharma-xy1qm Год назад

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

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

  • @shubhamanand8557
    @shubhamanand8557 10 месяцев назад +3

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

  • @guneeshvats46
    @guneeshvats46 7 месяцев назад +2

    Dude your lectures are amazing

  • @RRR-qv1so
    @RRR-qv1so Год назад +3

    Thank you for this amazing playlist bhaiya ❤❤

  • @BeWarrior-dw4br
    @BeWarrior-dw4br Год назад +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.

  • @aravindsagar9433
    @aravindsagar9433 7 месяцев назад +29

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

  • @lifehustlers164
    @lifehustlers164 Год назад +4

    17:20 , dream come true!!!

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

    Thank you sir this amazing lecture 🥰

  • @pratyushtripathi1728
    @pratyushtripathi1728 Год назад +2

    Understood 😊

  • @Vvvvviieiei123
    @Vvvvviieiei123 Год назад +1

    lecture 4 done,love u bhaiya

  • @ankit-jangid
    @ankit-jangid Год назад +5

    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

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

    👍😊

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

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

  • @chetashreejagtap7585
    @chetashreejagtap7585 Год назад

    thank you striver👍👍

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

    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

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

    Understood✅🔥🔥

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

    Thanks Striver!!!

  • @mainakdasgupta7130
    @mainakdasgupta7130 8 дней назад

    thank you

  • @TON-108
    @TON-108 Год назад

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

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

    thanks bhaiya for your efforts

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

    great work and thank you !

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

    Understood, thank you.

  • @RajNamdev_19
    @RajNamdev_19 5 месяцев назад +1

    Understood ;)

  • @rumiNITPatna
    @rumiNITPatna 28 дней назад

    thank u sir

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

    Thank You Bhaiya.

  • @artcodetravel
    @artcodetravel Год назад +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 6 месяцев назад +2

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

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

    understood ❤

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

    Nice videos thankyou

  • @om3478
    @om3478 19 дней назад

    understood!!!

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

    Lecture successfully completed on 26/11/2024 🔥🔥

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

    Completed!

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

    Undertood 😌

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

    🔥🔥🔥

  • @subee128
    @subee128 Год назад

    Thanks

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

    Understood !!

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

    Understood!

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

    nice video

  • @aaryangupta4505
    @aaryangupta4505 Год назад +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 4 месяца назад +1

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

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

    UNDERSTOOD;

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

    understood!

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

    the best!!!!

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

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

  • @harshuke5831
    @harshuke5831 Год назад

    Understood

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

    understood

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

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

    understooooooooooooood

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

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

  • @rizonkumarrahi
    @rizonkumarrahi Год назад

    Great

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

    why not swapping data values, that too would work

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

    can we exchange head with with tail and tail with head

  • @striverdaaadi
    @striverdaaadi Год назад

    striver is best

  • @ThakurIsGeek
    @ThakurIsGeek Год назад

    nice

  • @YashGaneriwal-je6rh
    @YashGaneriwal-je6rh 5 месяцев назад

    done

  • @UjjwalMishra-xf9un
    @UjjwalMishra-xf9un 6 месяцев назад +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;
    }

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

  • @himanshukaushik9223
    @himanshukaushik9223 Год назад

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

  • @adarshveerabathini8550
    @adarshveerabathini8550 28 дней назад

    We can use two pointers one starts from head and other from from tail and just swap the data till it reaches to the middle by taking the count.will it be a good solution can anyone pls respond to it.

    • @dhruvdonsahu9972
      @dhruvdonsahu9972 10 дней назад

      yeah same doubt , it'lll be better as it'll take n/2 but the only issue iswhen to stop there

  • @varun1017
    @varun1017 Год назад

    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;

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

    god

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

    understood 29 sep 2024

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

    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

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

    28-06-2024

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

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

    Understood 🫡

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

    Understood

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

    understood

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

    Understood

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

    understood

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

    understood

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

    Understood

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

    Understood

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

    Understood