Remove Loop from Linked List | C++ | Java | Python

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 45

  • @vijayalakshmiv3567
    @vijayalakshmiv3567 2 роки тому +5

    Wow.This is the best explanation.Everyone explains the code and how to do it.But no one explained how it works.Thankyou so much for such an awesome explanation.

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  2 роки тому +2

      Thank you so much Ruchi🥺😊 glad it was helpful

  • @adityan5302
    @adityan5302 10 місяців тому

    Just loved the explanation!!! Hat's offff

  • @yuvrajagarkar8942
    @yuvrajagarkar8942 Рік тому +2

    Please continue making such quality content, i loved the way you explained 'how' & 'why' the logic works in certain case, most creators don't do a good job explaining the 'why' part !!!
    keep up 👍

  • @abhisknowledge5514
    @abhisknowledge5514 11 днів тому

    just an idea !! to detect a loop in linked list so why cant we iterate from first and last so if they are equal then loop is detected?

  • @HARIHARAKRA
    @HARIHARAKRA Рік тому

    Plz post video regularly..you are sweet btw

  • @thalap_74-
    @thalap_74- 5 місяців тому

  • @paragdas9485
    @paragdas9485 2 роки тому

    Quality teaching. I appreciate.

  • @deepankurgupta569
    @deepankurgupta569 2 роки тому

    great explanation about the distance of the meeting point of the pointers.👍

  • @saiavinashduddupudi8975
    @saiavinashduddupudi8975 Рік тому

    Beautiful explanation of the mathematical proof at 12:16

  • @mayankpatidar9176
    @mayankpatidar9176 2 роки тому

    The way you teach.. Is another level mam... I saw your all video of coding ninja... Your teaching is next level and your voice is so so so smooth.

  • @ASIFAlI-lq4rd
    @ASIFAlI-lq4rd Рік тому

    LEETCODE SOLUTION FOR GIVEN PROBLEM.
    class Solution
    {
    static Node slow;
    public static Node detectLoop(Node head){
    slow = head;
    Node fast = head;
    while(fast != null && fast.next != null){
    slow = slow.next;
    fast = fast.next.next;
    if(fast == slow){
    return slow;
    }
    }
    return null;
    }

    public static void removeLoop(Node head){
    Node fast = detectLoop(head);
    if(slow == fast){
    slow = head;
    if(slow == fast){
    while(fast.next != slow) fast = fast.next;
    }else{
    while(slow.next != fast.next){
    slow = slow.next;
    fast = fast.next;
    }
    }
    fast.next = null;
    }
    }
    }

  • @AmarjeetKumar-to9ub
    @AmarjeetKumar-to9ub Рік тому +1

    Thank You :)

  • @FaisalKhan-ek5zy
    @FaisalKhan-ek5zy Рік тому

    Ab to pehle Like krta hu ,
    Fir Video start krta hu.. 😅

  • @gowrimanohari6682
    @gowrimanohari6682 2 роки тому

    best explanation!

  • @InderjeetSingh-eb8py
    @InderjeetSingh-eb8py 2 роки тому

    Very well explained👌

  • @nknidhi321
    @nknidhi321 2 роки тому

    Thanks Ayushi

  • @desihiphop4998
    @desihiphop4998 2 роки тому

    Di top knotch explanation 🔥🔥

  • @piyushparadkar6290
    @piyushparadkar6290 2 роки тому

    wow ! Nice explaination......

  • @showsshorts4696
    @showsshorts4696 Рік тому

    thankyou mam

  • @ajit287
    @ajit287 3 роки тому +1

    Nice Thumbnail...

  • @BrainyiFY_o0
    @BrainyiFY_o0 2 роки тому

    Python code showing type error
    How to deal with it

  • @ecs185_shaileshbharti3
    @ecs185_shaileshbharti3 2 роки тому

    💯👍✨

  • @abhimanyusingh5562
    @abhimanyusingh5562 2 роки тому +1

    time limit exceeding

  • @Sonu-tg6tg
    @Sonu-tg6tg 3 роки тому

    Please explain code in java as well

  • @sanchitkanojia5460
    @sanchitkanojia5460 3 роки тому

    Di in your telegram group only you will msg please allow us so we will put our doubts in this group

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 роки тому

      okay sanchit, thanks for letting me know😀

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 роки тому

      Let me know if you are still not able to msg

    • @sanchitkanojia5460
      @sanchitkanojia5460 3 роки тому

      @@AyushiSharmaDSA now the members of the group are able to put the msg. Thank you so much Di😊😊