Тёмный

L14. Detect a loop or cycle in LinkedList | With proof and Intuition 

take U forward
Подписаться 603 тыс.
Просмотров 52 тыс.
50% 1

Problem Link: tinyurl.com/3rxwup5c
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

Опубликовано:

 

28 ноя 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 95   
@md.ualiurrahmanrahat2400
@md.ualiurrahmanrahat2400 5 месяцев назад
No one even in paid courses also give the intuition behind the algorithms like you did Sir. You could have earned millions by paid courses but instead you chose to contribute for the greater well of the society. Hats off!
@adarshjhanitkurukshetra
@adarshjhanitkurukshetra 6 месяцев назад
Whole NIT and IIT follows you ♥, hats off
@AdityaGupta-cx1ej
@AdityaGupta-cx1ej 5 месяцев назад
Bro I am in IIIT-Kottayam we also follow not just IIT and Nit🙂
@frouMagician
@frouMagician 4 дня назад
@@AdityaGupta-cx1ej well, he did not say "only" NITs and IITs follow him, did he ?
@bishalkundu7592
@bishalkundu7592 7 месяцев назад
Knew this algorithm but came here to learn the proof ❤ And guess what Striver Bhaiyaa never disappoints ❤
@kamalakannanng4206
@kamalakannanng4206 3 месяца назад
The whole video is 10/10 but the intuition part is 1000/10. Just Striver things 🔥
@arzooqureshi8821
@arzooqureshi8821 7 месяцев назад
I am so glad i found this channel.The Best!
@divyatejaswinivengada6368
@divyatejaswinivengada6368 4 месяца назад
Hands down the best explanation I have seen in so many year's , I am forever grateful for such beautiful intuition and explanation
@aryanpinto5105
@aryanpinto5105 6 месяцев назад
The intuition part!🤌💯
@_CodeLifeChronicles_
@_CodeLifeChronicles_ Месяц назад
the best dsa course. i can code myself after the intuition.explanaton is crystal clear
@deepakbhatt03
@deepakbhatt03 6 месяцев назад
This is real teaching!
@tusharyadav5874
@tusharyadav5874 Месяц назад
Hi, Remember one thing slow and fast pointer will always meet if the ratio b/w speed of slow and fast pointer is greater than 1. There ratio can be in decimal also , But if you want them to meet fast in the loop then optimal speed will be slow = 1 and fast = 2. But if the two pointers move like slow = 3 and fast = 5 then they also meet. It will take multiple cyle but they will eventually meet.
@user-ql5pe3xc3p
@user-ql5pe3xc3p 2 месяца назад
Bro , i write my own bro by seeing your explanation ❤️ You are my God bro 🫂
@_dion_
@_dion_ 4 месяца назад
the best explanation on the internet.
@aruna5869
@aruna5869 2 дня назад
big hats off for the intuition part!!!🙌❤❤
@AbhijitSahoo-oc2lz
@AbhijitSahoo-oc2lz 6 месяцев назад
Many many Thanks for your effort Bhaiyaa ❤ you are in those teacher's of my life which i can never forger in my life❤💯
@franciskp9117
@franciskp9117 5 месяцев назад
Man you're a GENIUS !!!
@hareshnayak7302
@hareshnayak7302 2 месяца назад
Understood, thanks striver for this amazing video.
@tanya8353
@tanya8353 3 месяца назад
Wonderful explanation striver!!! You are really doing an incredible job!!
@anuplohar23
@anuplohar23 4 месяца назад
18:25 That's the reason why I preferred Striver's DSA playlist
@SaqibChoudhary09
@SaqibChoudhary09 4 месяца назад
Best DSA in YT
@kapilsolanki6844
@kapilsolanki6844 7 месяцев назад
Striver bhaiya linked list ki sbhi videos jldi se upload kr do , next month interview bhi h😇
@rishabh_pant
@rishabh_pant 7 месяцев назад
All the best brother 🎉
@shreyxnsh.14
@shreyxnsh.14 5 месяцев назад
how did it go?
@rahulmandal4007
@rahulmandal4007 18 дней назад
@@shreyxnsh.14 It was ok
@shrutishukla6336
@shrutishukla6336 2 месяца назад
Thankyou Sir for teaching us real problem solving.
@harshsingh357
@harshsingh357 2 месяца назад
🙌 Loved the way you explained the problem solution and intuition . Thank you very much .
@user-ik3qu5uy5e
@user-ik3qu5uy5e 4 месяца назад
you are great sir ! loads of love ❤
@SimranChetiwal-uy2xn
@SimranChetiwal-uy2xn 7 месяцев назад
Great Striver🤩🤩
@codingp110
@codingp110 Месяц назад
Awesome Explanation!
@NazeerBashaShaik
@NazeerBashaShaik 2 месяца назад
Understood, thank you.
@sarangkumarsingh7901
@sarangkumarsingh7901 12 дней назад
Awesome content Sir......
@tollytrendzvideos395
@tollytrendzvideos395 Месяц назад
A great explanation bro....... ❤
@pritagarwal6389
@pritagarwal6389 10 дней назад
very well explained Dek raha ha Binod Kitna easy hota ha DSA.....
@pratyushtripathi1728
@pratyushtripathi1728 6 месяцев назад
Understood 😊
@user-tk2vg5jt3l
@user-tk2vg5jt3l 4 месяца назад
Thank you bhaiya
@krishnakarule3708
@krishnakarule3708 9 дней назад
You are the best!!
@nayanbramhane8077
@nayanbramhane8077 5 месяцев назад
thanks for telling us the why 😁
@selene8721
@selene8721 2 месяца назад
Thank you so much!!
@YourCodeVerse
@YourCodeVerse 5 месяцев назад
Understood✅🔥🔥
@abhinavkumar6344
@abhinavkumar6344 3 месяца назад
great way to explain why fast and slow ptointers will collide definitely..🙅
@subee128
@subee128 7 месяцев назад
Thanks
@nrted3877
@nrted3877 13 дней назад
Thanks striver
@Abhishekthakur-mg4el
@Abhishekthakur-mg4el 7 месяцев назад
thanks bhai❤
@gaurishaaaa
@gaurishaaaa 5 месяцев назад
wish i could give you 1000 likes at once. Great explaination.
@user-or5oz1pk2x
@user-or5oz1pk2x 2 месяца назад
Thanks A Lot
@shaiksoofi3741
@shaiksoofi3741 10 дней назад
thank you
@nayanbramhane8077
@nayanbramhane8077 5 месяцев назад
thanks bro
@karmveersingh1334
@karmveersingh1334 5 месяцев назад
Understood 😇
@BarrytheClipper
@BarrytheClipper Месяц назад
If you still confused in H T approach then Imagine, the distance between Hare and Tortoise is 5m. So according to logic we move Tortoise by 1, the distance will be 5m and Hare by 2. So them the overall distance will be 6-2 =4m Our distance got reduced by 4m And if you keep continuing the approach eventually our distance will be zero And the same approach might work in 3. Bit it's depend on luck Like 5+1 = 6. Then 6-3 = 3m Again, 3+1= 4. Them 4-3 = 1m Again, 1-1 = 2. Them 2-3 = -1 m Overlapping.....
@chinmayraichur8984
@chinmayraichur8984 4 месяца назад
Understood!
@sayantanpoddar5428
@sayantanpoddar5428 3 месяца назад
Understood!!
@mayankshakya9200
@mayankshakya9200 7 месяцев назад
17:44 correction if we move slow by 1 and fast by 2,3,4,5 etc we still collide and get the answer i ve prove it if you want you can increment fast by >=2 by having the appropriate while check
@shreyxnsh.14
@shreyxnsh.14 5 месяцев назад
so that means what he said is wrong?
@shreyxnsh.14
@shreyxnsh.14 5 месяцев назад
3,4,5 wont work if the list has just 2 elements
@mayankshakya9200
@mayankshakya9200 5 месяцев назад
@@shreyxnsh.14 kind of yes or we can say that he hasnt explored about that…
@NARUTOUZUMAKI-bk4nx
@NARUTOUZUMAKI-bk4nx 5 месяцев назад
Understooood
@nehapimpalkar396
@nehapimpalkar396 5 месяцев назад
understood!
@SibiRanganathL
@SibiRanganathL 2 месяца назад
Understood
@manansarraf73
@manansarraf73 4 дня назад
GOD OF DSA->STRIVER
@rahuldwivedi4758
@rahuldwivedi4758 6 месяцев назад
Or we can also say, if fast->next == slow return true; to optimize by one step.
@hardikpatel352
@hardikpatel352 Месяц назад
understood
@tejastrivedi2023
@tejastrivedi2023 6 месяцев назад
While putting the condition fast!=NULL should come before fast->next != NULL,if you do vice versa then it will show pointer error
@Shivi32590
@Shivi32590 22 дня назад
Thank you !🌄
@rockstarCoolz
@rockstarCoolz 28 дней назад
Thx sir ,can u pls bring string playlist sir pls pls pls😅😅 i m excited for it...
@SunnyKumar-dw9ze
@SunnyKumar-dw9ze 7 месяцев назад
👍
@hatkereacts
@hatkereacts 6 месяцев назад
Striver only had one issue that could be heard from a few that his lectures are not beginer friendly. Now that's all the past , it is settled. This is BEST content to exist for all the STRIVERS out there to learn dsa period.! No matter how much dsa u have done earlier even if u r a beginer the A2Z sheet is hands down the best+
@4everachyut
@4everachyut Месяц назад
Is it necessary to increase the fast pointer only by 2? What if we increased it by 3 or 4? Will it still meet the slow pointer?
@dineshkumarrg4894
@dineshkumarrg4894 4 месяца назад
13:40 will know the intuition behind why slow and fast pointer will meet
@HarshMishra-hp2lt
@HarshMishra-hp2lt Месяц назад
Can we also use unordered_set instead of map?
@user-gw5kf6ih9s
@user-gw5kf6ih9s 3 месяца назад
relative motion yaad agaya
@ashishpradhan6250
@ashishpradhan6250 13 дней назад
underestood
@thesumitkumar0
@thesumitkumar0 5 месяцев назад
Time Complexity of this ?
@peterfromengland8663
@peterfromengland8663 4 месяца назад
what if the length of LL is 1 or 2?? will this code throw a error??
@rahuldwivedi4758
@rahuldwivedi4758 6 месяцев назад
while(fast !=null){ fast = fast->next; fast = fast -> next; slow = slow ->next; If(fast->next == slow) return true; } return false;
@VIJAYSHARMA-dh6vo
@VIJAYSHARMA-dh6vo 6 месяцев назад
instead of using fast->next 2 times you can simply write fast->next->next :)
@rahuldwivedi4758
@rahuldwivedi4758 6 месяцев назад
@@VIJAYSHARMA-dh6vo I know :). But my intention was to make it more obvious that fast is taking two steps when slow just takes one. Also I wanted to avoid that extra ugly check in while, ie, && fast->next->next != null (just a personal preference.)
@user-ot1rd8hd3d
@user-ot1rd8hd3d 5 месяцев назад
undersood
@iamnoob7593
@iamnoob7593 4 месяца назад
US
@user-sl9xm3cm3p
@user-sl9xm3cm3p 27 дней назад
Why not use a set instead of map?
@mananpareek6089
@mananpareek6089 29 дней назад
More efficient time and space complexity solution bool hasCycle(ListNode *head) { if(head==NULL || head->next==NULL)return false; ListNode*temp=head; while(temp) { if(temp->val==1e8)return true; temp->val=1e8; temp=temp->next; } return false; }
@rajputvanrajsinh9527
@rajputvanrajsinh9527 3 месяца назад
In your old website you given those links but now what you have given in your link is not good videos
@adityaasthana8758
@adityaasthana8758 Месяц назад
When we will move slow by 1 and fast by 3..then also they will collide....Yrr I don't understand why we are moving slow by 1 and fast by 2..pls anyone can help???
@abhijitjha4409
@abhijitjha4409 3 дня назад
ListNode* temp = head; int i = 0; while(temp){ if(temp && temp->val == INT_MAX) return true; temp->val = INT_MAX; temp = temp->next; } return false; Can this be a solution??? can i tell this to the interviwer ?
@ManasNandMohan
@ManasNandMohan 6 месяцев назад
Your explanation is op 💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥 💥 ❤‍🩹
@cenacr007
@cenacr007 3 месяца назад
us
@user-kn4zc2gt3r
@user-kn4zc2gt3r 9 дней назад
please use some hindi words please so that north indian student understand easily
@pradipkumarmukhi
@pradipkumarmukhi Месяц назад
Understood
@surbhigupta5777
@surbhigupta5777 27 дней назад
US
@dewanandkumar8589
@dewanandkumar8589 Месяц назад
Understood
@abhishekprasad010
@abhishekprasad010 Месяц назад
Understood
@codeman3828
@codeman3828 5 месяцев назад
Understood
@vedantnaikwadi5394
@vedantnaikwadi5394 25 дней назад
Understood
@himanshidafouty347
@himanshidafouty347 18 дней назад
Understood
@ig_strawhats_
@ig_strawhats_ Месяц назад
Understood
Далее
L15. Find the length of the Loop in LinkedList
14:01
Просмотров 33 тыс.
L9. Reverse a LinkedList | Iterative and Recursive
32:42
L21. Reverse Nodes in K Group Size of LinkedList
24:31
8 patterns to solve 80% Leetcode problems
7:30
Просмотров 227 тыс.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36