You are just greek god of teaching complex stuff in the simplest way possible!! God bless for your efforts.
@nikoo2811 ай бұрын
haha...will try my best to keep bringing such content
@JammUtkarsh Жыл бұрын
I must say you speak very politely and your explanation is LIT 🔥 🔥 🔥 🔥. I personally find your videos better NeetCode. Hope your channel grows!!!💜
@nikoo2811 ай бұрын
As long as you understand things, it is all that matters. 🙂
@debottamyoutube7 ай бұрын
What an explaination. Calm, cool, smiling, no use of complex words, it was like listening to a story. ❤ Subscribed!!!
@pranavm93018 ай бұрын
Very good explanation. in while condition, slow != null is not required because slow pointer is always behind fast and if there is a null, it's detected by fast pointer and we break out of loop
@GrowWithHare3 ай бұрын
Wow, I can't imagine you explained this problem so well. Thanks a lot bhaiya❤😊
@johncho91608 ай бұрын
can you pls explain what the purpose of fastPtr.next != null condition in the while loop? i understand that if slowPtr or fastPtr is null then it is not a cycle but why the third condition?
@nikoo287 ай бұрын
we want to make sure that we don't hit null pointer. It is not necessary that the linked list has a cycle for sure
@preetijavali65957 ай бұрын
Hi Thanks fo the video. Can you explain why while loop has 3 conditions? if fast pointer reaches null, its already proven that it doesnt have loo. also fast pointer will always reach null first, so why check for slow pointer is null or not? and why check fast pointer.next is null?
@nikoo287 ай бұрын
you are right...we can get rid of slowPtr check in the while loop.
@preetijavali65957 ай бұрын
@@nikoo28 Thank you.
@mahatrtАй бұрын
Hatsofff sirr🙌🫡🫡
@jayaveeran13 ай бұрын
Hi Nikhil, thanks for the amazing video, just one query do we really need the condition slowPtr!=null on the while loop ?
@priyanshgarg1292 Жыл бұрын
WHY NOT WE ARE moving hare with 3x or 4x or 5x etc... speed then also it will come in loop why only 2x speed?
@nikoo28 Жыл бұрын
While you could potentially use a higher speed like 3x, 4x, or 5x, using a speed of 2x ensures that the hare and tortoise pointers will eventually meet if there is a cycle. Using a higher speed than 2x might not guarantee this outcome. Let's explore the reasoning behind using a 2x speed for the fast pointer: - Balanced Progress: Moving the fast pointer at 2x the speed of the slow pointer creates a balanced progression. This ensures that the fast pointer catches up to the slow pointer at a steady rate. - Guaranteed Intersection: In a linked list with a cycle, the fast pointer will eventually enter the cycle. Since the cycle has a finite length, the fast pointer will "lap" the slow pointer (that's moving at a 1x speed) before they meet again. - Avoiding Overlooking Cycles: If you were to use a higher speed for the fast pointer, like 3x or 4x, you might inadvertently overshoot or skip over some cycles. This is because the fast pointer might move through multiple complete cycles while the slow pointer is still traversing through a single cycle. - Minimal Tracking: Using a 2x speed minimizes the number of steps required to find a cycle. While increasing the speed might lead to faster movement, it doesn't guarantee a more efficient cycle detection process.
@IshaZaka23 күн бұрын
plz make more videos, its so helpful
@TechTribers3 ай бұрын
very good explanation & easy to understand . Jus wanted to ask which application you use for writing in ipad like (goodnote ,notability)
@nikoo283 ай бұрын
GootNotes 6
@infinite6392 жыл бұрын
I can run the code on Leetcode but But i want to run it on my local IDE as a normal input output program You have only written test cases
@nikoo282 жыл бұрын
You can just copy the test case inside the main method and it will work
@sharabugnanesh3098 Жыл бұрын
I can't find the solution for this thing "Where to find the cycle first"😢
@nikoo2811 ай бұрын
this: kzbin.info/www/bejne/b2a9l6iliKaIhqs
@alisheheryar17706 ай бұрын
You hoped you simplified the solution. And yes you are Sire! you indeed simplified it. I hope i could give you a cookie.
@hamdasalam43733 ай бұрын
What an awesome explanation.Sir could you please come up with the continuation of the video on how to find the node at which the cycle occurs?, will be of great help
@kayathrivenkatesan77125 ай бұрын
thank u so much .i have been searching only for ur solution for evry prblm and go to other videos only if ur video is not present.ur videos and visuals bring more interest for me to solve problems
@shraddhajain89352 жыл бұрын
Hey! can you explain the while condition a bit more? For me it is failing for a test case like '[-21,10,17,8,4,26,5,35,33,-7,-16,27,-12,6,29,-12,5,9,20,14,14,2,13,-24,21,23,-21,5] -1' when it comes to a point where 'fast.next.next' is None. It is working when we are adding a null check for fast.next.next as well
@matthewzarate88514 ай бұрын
Your entire linked list playlist is amazing Nikhil!
@Dadu-g4r Жыл бұрын
Great explanation 🔥
@abuyousuf72819 ай бұрын
Sorry bro! Your solution exceeded the time limit of leetcode constraints. This approach is not accepted in Leetcode.
@nikoo289 ай бұрын
That can’t be possible, did you check the code in the github link available in the description? It passes on LeetCode
@abuyousuf72819 ай бұрын
@@nikoo28 sorry brother about my last comment. Yes this approach is good enough but I tried your same concept but that showed time limit exceeded. I want to let you know that I used Java. But after that I had seen another video which is same approach but differently. Like: ListNode slow = head; ListNode fast = head.next;a while(){ .... slow = slow.next; fast = fast.next.next; } Return true; And Buddy that passed the time limit constraint.
@abuyousuf72819 ай бұрын
@@nikoo28 Don't get me wrong sir, You’ve done an amazing job. Just wanted to let you know I've failed to pass my time limit.
@akashchakrabortty2431 Жыл бұрын
Thanks Nikhil, for explaining the approach so nicely
@vaibhavkgote Жыл бұрын
what application do you use to write in tab?
@nikoo28 Жыл бұрын
That would be Goodnotes 6.
@vaibhavkgote Жыл бұрын
@@nikoo28 Thank you !
@Thirushal0077 ай бұрын
such a simple explaination
@divyaawasthi828611 ай бұрын
Nikhil Bhai, Thankyou so much i got clarity on LL through your videos only...Very clear explanation you are doing great job Brother Proud of you.
@nikoo2811 ай бұрын
thanks so much
@chakravarthybatna1589 Жыл бұрын
your channel is underated, your videos are amazing bro , awesome explanation please keep posting new video's in english
@nikoo28 Жыл бұрын
I will try my best
@shivangchauhan820 Жыл бұрын
It would be good If you have made this video in hindi as there are not much viewers who don't understand hindi.
@nikoo28 Жыл бұрын
i will try to add subtitles in other languages
@arupbasak919 Жыл бұрын
Really I love your way of explanation...Also it made me easy to understand..
@nikoo28 Жыл бұрын
Happy to help
@rodba13937 ай бұрын
thank you so much you are the best!!!!!
@mayankbadika31017 ай бұрын
Great explanation :)
@AadeshKulkarni7 ай бұрын
Beautiful baba!
@safar19899 Жыл бұрын
Great explanation! Thank you!
@ashokrajan94012 жыл бұрын
Very nice explanation Brother
@parthmodi20287 ай бұрын
Ur vidoes are really helpful. Pls cover more problems
@nikoo286 ай бұрын
a new video every week.
@JH-wy2pc10 ай бұрын
Superb explanation
@kidoo1567 Жыл бұрын
Is this approach correct.. change the value of every node we are traversing as max integer. And check if we reach the node max integer again while traversing print true😅
@nikoo2811 ай бұрын
that works too, but then you are modifying the actual list. confirm with your interviewer if you are allowed to make changes.
@kidoo156710 ай бұрын
Yeah
@CodingSquirrel777 Жыл бұрын
Thank you AGAIN!!
@hunorvadasz-perhat6001 Жыл бұрын
Very nice and easy to understand explanation! Subscribed! 😄
@nikoo28 Жыл бұрын
thank you for subscribing.. :)
@kalyanamvenumadhav2245 Жыл бұрын
How to display value instead of true and false
@nikoo28 Жыл бұрын
Once you identify the node you stop at, you can store it's value somewhere and then return it.