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!
bro , i am with you in all of your debate , still he is earning heavily due to yt , maybe not particularly this video with 53k views at this point but he has videos with million views too
@@sakshammisra189 Yes. But he is not only earning money. He is earning prayers and blessings of millions of students like us. He is helping even foreign countries students as you won't see much videos from them. Indian TH-camrs took teaching to the next level through TH-cam.Thousands of us will get inspired to contribute like him when we become successful and have the opportunity. That's how he is shaping our minds.
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.
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.....
Understood very well. I just love the way you teach. Love you Striver Bro ❤ One day or other I will meet you in the Google office or somewhere else and I will thank you personally by hugging you tight Bhai ❤
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
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+
@@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.)
Wrong Answer 15 / 29 testcases passed Editorial Inputhead =[1,2] pos = -1 Use Testcase Output=true Expected=false the above test case fails to do so what about this condition?
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 ?
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???
If we follow, slow by by 1 and fast by 3 the resultant reduction between them will be 2 , and consider if initial b/w tem is 7 the follow will like this 7 - 5 - 3 - 1 - (-1)... No collision of them
The whole video is 10/10 but the intuition part is 1000/10. Just Striver things 🔥
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!
bro , i am with you in all of your debate , still he is earning heavily due to yt , maybe not particularly this video with 53k views at this point but he has videos with million views too
@@sakshammisra189 Yes. But he is not only earning money. He is earning prayers and blessings of millions of students like us. He is helping even foreign countries students as you won't see much videos from them. Indian TH-camrs took teaching to the next level through TH-cam.Thousands of us will get inspired to contribute like him when we become successful and have the opportunity. That's how he is shaping our minds.
@@sakshammisra189 Atleast, he is redeeming what he earns with his efforts and generosity
Whole NIT and IIT follows you ♥, hats off
Bro I am in IIIT-Kottayam we also follow not just IIT and Nit🙂
@@AdityaGupta-cx1ej well, he did not say "only" NITs and IITs follow him, did he ?
Hands down the best explanation I have seen in so many year's , I am forever grateful for such beautiful intuition and explanation
Knew this algorithm but came here to learn the proof ❤ And guess what Striver Bhaiyaa never disappoints ❤
the best dsa course. i can code myself after the intuition.explanaton is crystal clear
I am so glad i found this channel.The Best!
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.
Can you please explain how that works?
Bro , i write my own bro by seeing your explanation ❤️
You are my God bro 🫂
18:25 That's the reason why I preferred Striver's DSA playlist
The intuition part!🤌💯
Awesome video! I was doubting you'd actually explain the intuition in an intuitive way but you did it, thank you!!
Understood, thanks striver for this amazing video.
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.....
I am having so much fun with your videos. They are so clear and interesting. You are doing a great job!
You are best teacher on TH-cam ❤
Wonderful explanation striver!!! You are really doing an incredible job!!
This is real teaching!
🙌 Loved the way you explained the problem solution and intuition .
Thank you very much .
Many many Thanks for your effort Bhaiyaa ❤ you are in those teacher's of my life which i can never forger in my life❤💯
the best explanation on the internet.
Understood very well. I just love the way you teach. Love you Striver Bro ❤ One day or other I will meet you in the Google office or somewhere else and I will thank you personally by hugging you tight Bhai ❤
What a clarity !!! God level explanation at end
Striver bhaiya linked list ki sbhi videos jldi se upload kr do , next month interview bhi h😇
All the best brother 🎉
how did it go?
@@shreyxnsh.14 It was ok
For which company?@@rahulmandal4007
Thankyou Sir for teaching us real problem solving.
big hats off for the intuition part!!!🙌❤❤
Your at a whole new level
Great explanation of the intuition ❤
Best DSA in YT
very well explained
Dek raha ha Binod Kitna easy hota ha DSA.....
great way to explain why fast and slow ptointers will collide definitely..🙅
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
so that means what he said is wrong?
3,4,5 wont work if the list has just 2 elements
@@shreyxnsh.14 kind of yes or we can say that he hasnt explored about that…
Man you are great, simply great!!!
While putting the condition fast!=NULL should come before fast->next != NULL,if you do vice versa then it will show pointer error
brw there is no videos on string please upload the video it will be very useful for us please upload it Asap
Easier Solution could be :
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode* temp=head;
while(temp!=nullptr){
if(temp->val==1e7){
return true;
}
temp->val=1e7;
temp=temp->next;
}
return false;
}
};
Man you're a GENIUS !!!
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+
Thx sir ,can u pls bring string playlist sir pls pls pls😅😅 i m excited for it...
GOD OF DSA->STRIVER
wish i could give you 1000 likes at once. Great explaination.
while(fast !=null){
fast = fast->next;
fast = fast -> next;
slow = slow ->next;
If(fast->next == slow) return true;
}
return false;
instead of using fast->next 2 times you can simply write fast->next->next :)
@@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.)
A great explanation bro....... ❤
you are great sir ! loads of love
❤
Awesome content Sir......
Awesome Explanation!
Great Striver🤩🤩
Or we can also say, if fast->next == slow return true; to optimize by one step.
thanks for telling us the why 😁
you are genius i love you thank you so much
13:40 will know the intuition behind why slow and fast pointer will meet
You are the best!!
Intution - ground mein do ladke bhaag rahe ek dusre se tez hai...aisa koi na koi point to aega hi na jab tez wala ladka dhere wale ko pakad lega.
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?
See the video completely. U will get to know
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;
}
Can we also use unordered_set instead of map?
Understood 😊
Understood, thank you.
Thanks striver
Wrong Answer
15 / 29 testcases passed
Editorial
Inputhead =[1,2]
pos = -1
Use Testcase
Output=true
Expected=false
the above test case fails to do so what about this condition?
Thank you bhaiya
Thank you so much!!
Awesome!
In your old website you given those links but now what you have given in your link is not good videos
thank you
Thanks A Lot
Understood✅🔥🔥
Why not use a set instead of map?
what if it has same elements ?
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 ?
bool hasCycle(ListNode *head) {
if(head == NULL) return false;
ListNode* temp = head;
int n = 10000; //given contraint
for(int i=0; inext == NULL){
return false;
}
temp = temp->next;
}
return true;
}
big brain move
relative motion yaad agaya
Understooood
what if the length of LL is 1 or 2?? will this code throw a error??
Thanks
Time Complexity of this ?
thanks bro
underestood
Understood
thanks bhai❤
I am struggling with chatgpt why move 1 and why move 2. then I was jump to this video
Understood!
understood
understand
understood!
❤
undersood
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???
If we follow, slow by by 1 and fast by 3 the resultant reduction between them will be 2 , and consider if initial b/w tem is 7 the follow will like this 7 - 5 - 3 - 1 - (-1)... No collision of them
Thanks @@nishantgupta5015
🐐
👍
respect++;
US
us
Your explanation is op
💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥
💥
❤🩹
please use some hindi words please so that north indian student understand easily
Thank you !🌄
Understood
Understood
😇
Understood!!
US