L17. Find the starting point of the Loop/Cycle in LinkedList | Multiple Approaches

  Рет қаралды 49,521

take U forward

take U forward

Күн бұрын

Problem Link: tinyurl.com/4c5a64xv
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

Пікірлер: 167
@tanya8353
@tanya8353 4 ай бұрын
Dammmmnnnn!!!! This man leaves no "Why?" unanswered!!! Wonderful job Striver...keep up the good work!!
@zainabkhan-ym3kh
@zainabkhan-ym3kh 5 ай бұрын
Striver I desperately wants to know from where you learn these concepts and making this huge impact on us. Hats off you.
@MayankRawat-b9m
@MayankRawat-b9m Күн бұрын
Damn I was blown away, literally. I was like, This is how the starting point is detected. As you said, I don't think anyone will teach us in this depth.
@kamalakannanng4206
@kamalakannanng4206 3 ай бұрын
The entire video 10/10 but the intuition part is 100000/10. Hat's off Striver !❤‍🔥
@hat_awesome21
@hat_awesome21 8 ай бұрын
Striver isn't pregnant , but delivers faster
@pavankh9496
@pavankh9496 8 ай бұрын
😂
@VaibhavGhage
@VaibhavGhage 7 ай бұрын
wtf 🤣🤣🤣
@maverick_8707
@maverick_8707 3 ай бұрын
😂😅
@jeet-smokey
@jeet-smokey 3 ай бұрын
Kesi apmaan janak baatein kar raha he ladka ye
@aayush1204
@aayush1204 3 ай бұрын
Ashleel hai ye londa
@NoName-gr6sz
@NoName-gr6sz 6 ай бұрын
i have been watching your dsa series since almost 1 month. this intuition shocked me... literally.. no youtuber or tutor teaches the way you teach. i really appreciate the way you teaches ... hats off sir.
@Aditya_6996
@Aditya_6996 2 ай бұрын
How do i even think of the optimal approach the way you do , just CRAZYYYY
@nehaagarwal6049
@nehaagarwal6049 6 ай бұрын
Another way to put the intuition can be : If the starting point of loop is at distance x from head, cycle length is c and the point where slow and fast meet is at distance y from the starting point, as we know the slow and fast starts at head and slow moves by 1 and fast moves by 2 from the start, we can say, 2*distance traveled by slow pointer = distance traveled by fast pointer. ==> 2*(x+y) = x + c + y ==> x = c-y Thus we can say that the distance of head to start of the loop is the same as the fast to start point of the loop. So if we update slow by head, and move slow and fast simultaneously then the point where we meet is the start point of the loop.
@uddayagupta911
@uddayagupta911 5 ай бұрын
Wow, this really helped me put things into perspective, thanks for the explanation!!
@bharath3387
@bharath3387 3 ай бұрын
A minor correction factor would be that c is multiplied with n , which is length of the cycle, as there is no assurance that both slow and fast pointer collide during the second rotation itself. 2 * (x+y) = x + y + nc
@nehaagarwal6049
@nehaagarwal6049 3 ай бұрын
@@bharath3387 They will definitely meet in the 2nd rotation as the initial distance from fast to slow is d(as Striver mentioned), which will always be less than the cycle length. And they meet in d steps as they fast to slow distance is decreasing by 1 with every step.
@isukapallisravani6809
@isukapallisravani6809 2 ай бұрын
This really helped Thank you
@Kruthi406
@Kruthi406 26 күн бұрын
Thank you so much for the explaination.
@agamsrivastava8037
@agamsrivastava8037 4 ай бұрын
The thought process behind the intuition was on point!
@dhawalshinde124
@dhawalshinde124 9 күн бұрын
thank you striver. now i am able to discover patterns in problems and able to think for both brute and optimal solutions for them.
@b_53_sweetypandre70
@b_53_sweetypandre70 5 ай бұрын
Very well explained.....and in most of the questions we are playing with fast and slow ptr. Loved the series!!!!!
@saouli1632
@saouli1632 6 ай бұрын
very crystal clear concept dada .Thank you bhiya for all your hard work. very well understood.
@sudiptakhotel1204
@sudiptakhotel1204 4 ай бұрын
The explanation of why behind the logic 🔥
@muditnagpal2740
@muditnagpal2740 23 күн бұрын
Great Explanation. Finding it very difficult to understand this concept but you made it so easy. Thanks!!
@stith_pragya
@stith_pragya 3 ай бұрын
Understood..........Thanks a ton for the video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@umber3117
@umber3117 7 ай бұрын
Understood. Thanks for the video.
@krishnaverma7328
@krishnaverma7328 18 күн бұрын
Sir you are the best teacher your way of teaching is absolutely good. ❤
@neemaparnami8604
@neemaparnami8604 13 күн бұрын
Excellent explanation sir!! Thank you so much for these lectures!!
@kale-lb5pr
@kale-lb5pr 6 ай бұрын
ek number lecture mast!!!!!!!!!!!!!!!!!!!!!!!! samj aa gya thanks!!!!!!!!!!!!!!!!
@mihirgadhe5678
@mihirgadhe5678 7 ай бұрын
best tutor, keep going sir. also want you to teach development.
@sonakshibajpai6445
@sonakshibajpai6445 Ай бұрын
Thank you striver ! understood!
@justvibin6601
@justvibin6601 2 ай бұрын
What an intuition man !
@PavithraSubu-un5bl
@PavithraSubu-un5bl Ай бұрын
OMG, the intuition was on point!. Thank you striver jii
@NazeerBashaShaik
@NazeerBashaShaik 3 ай бұрын
Understood, thank you.
@tgayush1424
@tgayush1424 Ай бұрын
Awesome , your new videos are much better, update the link of videos in your tuf sde list, it is linked to old video
@codingisfun-pranayharishch3001
@codingisfun-pranayharishch3001 2 ай бұрын
thank you so much.. really helped me a lot
@suyashjain3223
@suyashjain3223 Ай бұрын
Amazing Explanation!!!
@shaikkhizar8133
@shaikkhizar8133 8 ай бұрын
Super Explaination sir
@AppaniMadhavi
@AppaniMadhavi 3 ай бұрын
superb that logic!!
@chaitanyagalande5093
@chaitanyagalande5093 5 ай бұрын
the proof was really well explained 👍
@nagavedareddy5891
@nagavedareddy5891 13 күн бұрын
You're a Genius !
@deepigaravichandran
@deepigaravichandran 6 күн бұрын
Understood ! Thank you Striver 🙏
@darkwarrior6767
@darkwarrior6767 18 сағат бұрын
hi pretty
@anastasiiamaslova4220
@anastasiiamaslova4220 8 ай бұрын
best explanation!
@user-or5oz1pk2x
@user-or5oz1pk2x 3 ай бұрын
Thanks a lot Bhaiya !!
@being_ganguly
@being_ganguly Ай бұрын
I am an intern at Siemens and came back to this video for the proof even though I know the code. Thanks, Striver particularly for this amazing tutorial.
@anonymous13378
@anonymous13378 Ай бұрын
MY first yr is done and I have started dsa and little bit development also... My second year will start from 24 July by then how much should I cover so that I get a lead.... Plz answer if possible
@MultiFacebookers
@MultiFacebookers 19 күн бұрын
@@anonymous13378I’m 2 years experienced and I’m starting DSA again.. it’s never too late you’re begun so early don’t lose the momentum keep it up and you will reach wherever you want if only you stay consistent..
@MultiFacebookers
@MultiFacebookers 19 күн бұрын
I would say cover array, linked list, strings common operations and question types and you will be good to appear for internship interviews.
@rockstarCoolz
@rockstarCoolz Ай бұрын
Understood sir very clear,thx sir
@swapnil243
@swapnil243 8 ай бұрын
Detailed explanation as always!
@user-tk2vg5jt3l
@user-tk2vg5jt3l 5 ай бұрын
Thank you Bhaiya
@ReNaq313
@ReNaq313 4 ай бұрын
Awesome!!
@selene8721
@selene8721 3 ай бұрын
thank you so much!!
@KSSRINIVASEAEB
@KSSRINIVASEAEB 3 ай бұрын
love your videos
@manishmahajan6094
@manishmahajan6094 2 күн бұрын
Best explanation
@AkashRoy-do2dg
@AkashRoy-do2dg Ай бұрын
the explanation is phenomenal but yes It took me time cuz my ADHD ass can't concentrate on a single topic for a long time but I'm trying to improve and striver tussi great ho ji
@amanshrivastav0405
@amanshrivastav0405 2 ай бұрын
Thankyouuu Striver🤗
@divyatejaswinivengada6368
@divyatejaswinivengada6368 5 ай бұрын
Man awesome!!
@nishantsirwani3812
@nishantsirwani3812 3 ай бұрын
Awesome!
@abhaymandal4903
@abhaymandal4903 6 ай бұрын
Wow, how did one made this intuition for the very first time
@JugMelodies
@JugMelodies 8 ай бұрын
Understood 👍🙌
@khalasianiket816
@khalasianiket816 Ай бұрын
understood ❤
@shivisingh9975
@shivisingh9975 2 ай бұрын
Understood sir!
@NikhilKumar-vf9vo
@NikhilKumar-vf9vo Ай бұрын
God tier content !!!!
@banothutharun2743
@banothutharun2743 5 ай бұрын
superb sir 🤩
@YourCodeVerse
@YourCodeVerse 6 ай бұрын
Understood✅🔥🔥
@codingkatta7721
@codingkatta7721 7 ай бұрын
Understood 🙌🙌🙌
@prasadm3614
@prasadm3614 Ай бұрын
Congratulations on .6 million subscribers!!!!! 🎉❤🎉❤
@madhu_mohanreddy
@madhu_mohanreddy Ай бұрын
.6💀
@perseverance2814
@perseverance2814 Ай бұрын
Mind Blowing
@rahulmandal4007
@rahulmandal4007 Ай бұрын
Thank you🥰
@subee128
@subee128 8 ай бұрын
Thanks
@AmanVerma-iu8jp
@AmanVerma-iu8jp Ай бұрын
Genius is all I can say .
@subhanjana938
@subhanjana938 3 ай бұрын
The intuiton part 💯
@vattiyeshwanth282
@vattiyeshwanth282 2 ай бұрын
This is what happens when a Pro coder is also having insane teaching skills.
@dewanandkumar8589
@dewanandkumar8589 2 ай бұрын
UNDERSTOOD
@Shivi32590
@Shivi32590 Ай бұрын
Thank you!
@errahulrajocjp
@errahulrajocjp 7 ай бұрын
Understood!!
@RituSingh-ne1mk
@RituSingh-ne1mk 7 ай бұрын
Understood!
@ravijha377
@ravijha377 8 ай бұрын
understood!
@satyareddy8671
@satyareddy8671 7 ай бұрын
super anna
@RajNamdev_19
@RajNamdev_19 4 күн бұрын
Understood
@MaheshPatil-of1zy
@MaheshPatil-of1zy 24 күн бұрын
For the submission of the Leetcode we have to do minor changes in the code for the fast pointer.
@divyachaudhary-
@divyachaudhary- 21 күн бұрын
Like what?
@user-hy4rz6xw9w
@user-hy4rz6xw9w 6 ай бұрын
Understood.
@dancewitharyan3295
@dancewitharyan3295 6 ай бұрын
Understood!!!
@NARUTOUZUMAKI-bk4nx
@NARUTOUZUMAKI-bk4nx 6 ай бұрын
Understoooood
@rashmiranjannayak8638
@rashmiranjannayak8638 8 ай бұрын
Strivee bhai kya speed hai aapka😅
@divyanshmishra8136
@divyanshmishra8136 5 ай бұрын
what is time complexity of optimal approach and how you found it?
@satyasaineelapala570
@satyasaineelapala570 4 ай бұрын
understood
@user-lo2rd7gv6d
@user-lo2rd7gv6d 3 күн бұрын
ok right now i am at 12:39 and i saw the pseudocode and approach.About to watch the intuition with the sad fact in ma mind ki even tho i go through the method again and again...still i will forget.Another thing i want to say is i m stunned by the approach.Let's see what happens further.
@user-lo2rd7gv6d
@user-lo2rd7gv6d 3 күн бұрын
Ok watched it now, Blown away by the intuition, Thanks Raj dada.
@DineshKumar-pw7qb
@DineshKumar-pw7qb 5 ай бұрын
Hey striver What is the time complexity for hashing method in case of java? Is O(2N) right?
@yasaswinikarumuri9590
@yasaswinikarumuri9590 17 күн бұрын
Understood the intution. Such a great explanation. But how can one come up with such an optimal solution?Like how is it possible??
@MaheshPatil-of1zy
@MaheshPatil-of1zy 24 күн бұрын
time complexity for the optimal approach is O(2N)?
@naturesrevolution
@naturesrevolution 2 ай бұрын
at 17:30 if fast moves in distance(d) at speed of 2 then it becomes d/2 right then why is he saying d-2? Anyone pls say ?
@skbadsha910
@skbadsha910 2 ай бұрын
suppose the d was 5, and the fast moves by 2, then after 1 moves the d become 3 (5-2). that's why d also become d-2.
@piyushmakad4768
@piyushmakad4768 5 ай бұрын
Too intelligent 🧠
@user-xp3hf2mb2u
@user-xp3hf2mb2u 3 ай бұрын
What will be time complexity of optimal approach ? Plz answer
@amanjain4587
@amanjain4587 3 ай бұрын
kinda understood
@gorijellisameeravighneswar7360
@gorijellisameeravighneswar7360 5 ай бұрын
can anyone explain how fast covered 2d
@thisisRandom-ut9iq
@thisisRandom-ut9iq 6 ай бұрын
Please do string playlist .
@ahmedalam99
@ahmedalam99 2 ай бұрын
what will be the time complexity?
@ekheerastaadhyatmikgyan3100
@ekheerastaadhyatmikgyan3100 Ай бұрын
Time complexity for optimal approach?
@TheDev05
@TheDev05 7 ай бұрын
How would someone came to these optimal approach at first glance (if not done before), in interviews?
@NoobDeveloperYoutube
@NoobDeveloperYoutube 6 ай бұрын
No one can. That's why we are watching these. 😁
@dhruvchopra26
@dhruvchopra26 6 ай бұрын
Exactly! Sometimes DSA feels like sab ratna padega tbhi kr payenge
@NoobDeveloperYoutube
@NoobDeveloperYoutube 6 ай бұрын
@@dhruvchopra26 Let me tell you my experience and how this dsa help us in real world. See DSA Taught us to stay with problem and try to solve it. The more you stay with problem, more chances you will be able to solve that. Similarly in real world , when you will come across bugs and you try to fix those then you will have stay with bug , understand how, why, and from where it produced. And All you do is just debug the code to understand process. Ab isme sbse badi cheez ki tumhe pta bhi nhi chlega aur tumhe codebase ki poori information ho jaaegi , jaise jaise tum bug fix krte chle jaaoge. And there we have our biggest learning , codebase of thousands of lines of code and now we know which thing happening from which code.
@NoobDeveloperYoutube
@NoobDeveloperYoutube 6 ай бұрын
In starting , I also did this mistake whenever I came across any bug I directly asked my senior but they refuse to tell me about how to fix that. In response to that they ask me to come up with some solution first and then they will tell me about the right one. And booom Now I know about the codebase completely.
@tradeiteasyy
@tradeiteasyy 56 минут бұрын
If it contains duplicate nodes ?
@user-ph9sv2ro5b
@user-ph9sv2ro5b 2 ай бұрын
why cant we do like this, like at the collision , if we take low->next->next->next it will be my ans ?
@RasikaChinnadurai
@RasikaChinnadurai 28 күн бұрын
if you were my teacher i will be topped in all my semesters
@shivaniagg6123
@shivaniagg6123 4 ай бұрын
What if we fast pointer moves 3 times?
@shashankgujarathi8390
@shashankgujarathi8390 7 ай бұрын
In question there are asking us to return the position of the node, but in the code we are returning the node itself. Could you please tell me how the test cases are getting passed even if we are passing node instead of position.
@twinklelight9829
@twinklelight9829 7 ай бұрын
as you can see the return type of the function is node* we need to return node..if its int then we would return position
@rizwan-io
@rizwan-io 8 ай бұрын
18:23 siri found something
@manishaduggal3985
@manishaduggal3985 3 ай бұрын
What if length of the loop is lesser than l1
@user-jy7gu5jf2q
@user-jy7gu5jf2q 2 ай бұрын
why not hashset?
@Vishal-h5h
@Vishal-h5h 4 күн бұрын
Hey Striver What notebook are you using for teaching 👀
@theornament
@theornament 5 ай бұрын
Understood! For the people that didn't understand the demonstration, Neetcode explains this as well in his video of Floyd Cycle Detection. This is no shade, I love Striver, I just understood the demonstration better in Neetcode's video.
@arunsks3337
@arunsks3337 3 ай бұрын
Thanks, after seeing your comments i watched that video from neetcode and understood
@user-zf9lq9jp5s
@user-zf9lq9jp5s 7 ай бұрын
can somebody please explain how's the distance between slow and collision point is d
@naveensah4000
@naveensah4000 7 ай бұрын
Count the nodes they are equal
@manishnangliya8194
@manishnangliya8194 7 ай бұрын
initially he assumed that the distance between fast and slow is d... and the distance between slow to fast isL1. means total cycle is of length d+L1. After every step distance is reduced by 1 ( d -2 step of fast ( comming close to slow) + 1 step of slow ( going away from fast) . i.e d-2+1 = d-1...... and so on till 0. now slow and fast met at a node. Now we see after a point the d become 0 and in each step d is reduces to 1... means we totally reduced d steps that means slow/ fast in total moves d steps.... now it means the distance between intersaction point to met point of slow and fast is d.... but our cycle is of length d+L1... so the distance between met point to intersaction point is L1.
@parkourblog5076
@parkourblog5076 5 ай бұрын
has anyone else heard the background voice at 18:22 saying "see this what i have found" ?
@souvik33and37
@souvik33and37 21 күн бұрын
yep! here's what I found
@sayantanpoddar5428
@sayantanpoddar5428 3 ай бұрын
God striver
L18. Delete all occurrences of a Key in DLL
11:13
take U forward
Рет қаралды 34 М.
L14. Detect a loop or cycle in LinkedList | With proof and Intuition
20:26
UNO!
00:18
БРУНО
Рет қаралды 3,1 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 5 МЛН
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 290 М.
L12. Find the intersection point of Y LinkedList
32:05
take U forward
Рет қаралды 53 М.
Why Do Bubbles Form In Glasses Of Water?
12:33
Joe Scott
Рет қаралды 104 М.
Roblox, Im Sorry...
8:44
Chaseroony
Рет қаралды 74 М.
L21. Reverse Nodes in K Group Size of LinkedList
24:31
take U forward
Рет қаралды 69 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 441 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 633 М.
L4. Reverse a DLL | Multiple Approaches
18:30
take U forward
Рет қаралды 63 М.