@@parthibchowdhury5558 I was having the same doubt.. I think it is because the datatype used is "int" and the test cases are weak so there is no test case present where actually the value(arr[i]-arr[i-1]) is perfectly divisible by dist ...because even if you remove this if condition and dont do the decrement, then also the code is working completely fine.
This guy is a pure genius. The efforts he put in to explain such a complex problem with such simplification requires a genius mind. Kudos to your efforts.
@@GeneralistDev its just a pattern we follow to solve the problems to get the polarity principle where the answer we are looking for always resides at low index for y.y.y.y.n.n.n.n.n problems.
Though Striver Bhaiya is at a very nice position today, but according to me, he deserves even more...................God Bless You Bhaiya.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻 Thanks a ton..........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Understood Sir, It is most amazing problem I find in binary search and really required more attention, and Sir you have explained it very well in three different approaches , thanks a lot for the video.
Agar Bharat phir se vishwa guru banta h to Bharat ke us mahan vishwavidyalay me Data Structures and Algorithms ki neev aap hi rakhenge. Aap hi honge DSA ke sabse mahaan teacher. Salute 🫡
Bhaiya,I solved this question on my own(but for not a double case as in question i just done the question if it completely considering everything in integers......but the intution remained same for it too but with the change of dealing with float/double values.....)but it still boosted my confidence.....thank u bhaiya....i don't say i have improved 1000 times and i can solve any level of question on BS but i am improving with each video and maybe at a point i can solve questions as easy as u do....
Words cannot portray how much grateful I am to you and your teaching. Never ever I have understood a topic with such clearness and depth. Thanks to you I could solve all the problems right from Aggressive cows till Painter's Partition without even looking at any hints.Cannot explain the surreal feeling of getting green ticks on a LC Hard problem that too in the first submission itself!!
striver bhaiya when can we expect the strings playlist? ur explanation is far better than anyone else . and before the fanboys come at me saying that " striver has a job , have patience" , im just asking when we can expect not forcing him :)
Striver please please please Continue with the series ..... Placements are approaching , Completely dependent on ur way of teaching .....Kindly upload videos and complete dsa as early as possible
Before Optimizing this with BS It was preety Easy to Solve but When it comes to furthur optimize, the question changes it's difficulty to Hard Nicely Explained Thank You Bhai
❗❗FOR THOSE who were not able to get why Striver has written the following line in the last approach: if((arr[i] - arr[i - 1]) / dist) == numberInBetween * dist) THIS IS A MISTAKE IT SHOULD BE: if((arr[i] - arr[i - 1]) == numberInBetween * dist) i.e if a = b / c, then for the confirmation you will do -> b == a * c, not b / c == a * c. Thanks🙏🏻🙏🏻
Bhai site thik kar rahe ho to sath me CN ki jagah GFG ki link dal do please... Or you can make another section beside of CN links, for GFG links please 🥺
hey Striver , Just a Small request sir can pls give us the , List of Topics that you will be covering monthly So it will easy for us to knew till when we are able to complete the dsa
I dont think we need the line if((arr[i] - arr[i-1]) == (dist * numberInBetween)) { numberInBetween--; } Beacause even if you remove this line of code, the code gets submitted. I think this is because if we dont have this line, the cnt will be overestimated and so it will automatically execute low=mid and in doing so, it will further execute the high=mid calls and we will reach a answer closer to the actual ans with diff less than 1e-6
If we will make ans variable and try to return it as answer. It will not work in cases where the high itself is the answer , because the mid will never be equal to high , hence the no. of stations function will never return true , hence ans variable will never change . It will just return the value with which it was initialised.
Sir what do you suggest if i am able to solve question from your sheet after looking at some part of videos or some discussion section of leetcode i mean i am not able to solve new questions by myself but after learning i am able to solve thosr types . So i was just wondering whether its right to look up at the solutions and learn from it or should give more time to solve questions by myself only ? Its a honest question i wish you can answer.
same case with me...i think we should just solve more and more problems(by looking at solution) until we get used to the pattern of solving the questions!
at 36:50 line number 13, shouldn't it be long double newSecLen = inDiff / (long double howMany[secInd]); There is no need for a +1 because we already incremented howMany[secInd] at line number 11.
hi I have solved your a to z sheet and it is a great help but recently you have removed the gfg links and I usually revise from the code that i have solved in the ide. please add the gfg links as well and do not remove the leetcode links. thanks
At 37:20, should we only need to insert only one part of the distance or all the parts of the distance, I mean, if there are gas stations at 1 and 13, when we place a new gas station at 7, we will have two distances now, right? 1 to 7 and 7 to 13. We need to insert both distances right. But we are only inserting one of them(Into the Priority Queue).
because we only wants the distance to check whether it is maximum or not. Since the all the distances in that particular range will be equal so taking only one distance is enough.
My bad, a small correction in the code:
if((arr[i] - arr[i-1]) == (dist * numberInBetween)) {
numberInBetween--;
}
1 == (2 * 0.5)
bhai gfg ki link striver A2Z me add karo plz striver sheet is incomplete without gfg
I am confused.. how it is passing all the test cases then? By the way, Great Explanation love it😇
@@parthibchowdhury5558 I was having the same doubt.. I think it is because the datatype used is "int" and the test cases are weak so there is no test case present where actually the value(arr[i]-arr[i-1]) is perfectly divisible by dist ...because even if you remove this if condition and dont do the decrement, then also the code is working completely fine.
Some test cases are failing because of this condition on gfg, after removing it all cases passed. I'm still confused why this is happening.
if(fmod((long double)(arr[i+1]-arr[i]),mid)==0) numberInBetween--;
modulus work only in case of int so fmod
Striver is trying his very best to explain but the problem itself is very complex. Hats off bro...
This guy is a pure genius. The efforts he put in to explain such a complex problem with such simplification requires a genius mind. Kudos to your efforts.
What a noble man. May he achieve all the success that he wants
he had already achieved it
@@sohamgaikwad15 still more go
Guys those of you saying use low
I think all almost all of them😅
@@infinityzero2321 yes bro
please explain here only, I don't have time to go through whole playlist
@@GeneralistDev nhi bateynege poora dekh
@@GeneralistDev its just a pattern we follow to solve the problems to get the polarity principle where the answer we are looking for always resides at low index for
y.y.y.y.n.n.n.n.n problems.
Sir please continue the series ...a lot of students are waiting eagerly for your videos .
Though Striver Bhaiya is at a very nice position today, but according to me, he deserves even more...................God Bless You Bhaiya.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Thanks a ton..........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Understood Sir, It is most amazing problem I find in binary search and really required more attention, and Sir you have explained it very well in three different approaches , thanks a lot for the video.
Hard problem to absorb...! Kudos to your efforts, hats off Striver for your dedication
Agar Bharat phir se vishwa guru banta h to Bharat ke us mahan vishwavidyalay me Data Structures and Algorithms ki neev aap hi rakhenge. Aap hi honge DSA ke sabse mahaan teacher. Salute 🫡
Not only Indian programming community but also the entire world programming community is in your debt Sir.
UNDERSTOOD...........Thank You So Much for this wonderful video..............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
i'm cooked enough bro !!!!!!!!!!!!!!!!!!! hat's of to raj !!! he has tried his best to explain this .
The best DSA course on the Internet
Effort level:- Inspirational 🏆
it's so hard to wait for gem videos like this , I got a very clear view of BS just because of you bhaiya. Thanks
I would rather fail interview than trying this binary search solution
took me 3 hours to make through this video
Understood but a revision is needed to recall the approach of it. Thank you for the explanation, Raj bhiya .
not missing a single intuition, even if video length goes high, hats off bro..🔥🔥
I can never fully express my gratitude for your efforts, Striver Bhaiya. Your explanations are consistently unparalleled and truly THE BEST!
Dedication, Made Respect to him!! GIving a complete insight on the topic is just insane and very few people do it!
Best explanation! this was my first hard problem, but you made it so easy to understand. Hats off bhaiya!!!!
Bhaiya,I solved this question on my own(but for not a double case as in question i just done the question if it completely considering everything in integers......but the intution remained same for it too but with the change of dealing with float/double values.....)but it still boosted my confidence.....thank u bhaiya....i don't say i have improved 1000 times and i can solve any level of question on BS but i am improving with each video and maybe at a point i can solve questions as easy as u do....
ssup bro, can i dm you?
i just started and need some guidance
Striver is excellent to teach hard concept in a easiest way.
Bhai last decimal vala sach me hard h... 2 solution to iska easily samjh gaya. I will give again try tom , at least 30 % aaj samjh me aa gaya.
Words cannot portray how much grateful I am to you and your teaching. Never ever I have understood a topic with such clearness and depth. Thanks to you I could solve all the problems right from Aggressive cows till Painter's Partition without even looking at any hints.Cannot explain the surreal feeling of getting green ticks on a LC Hard problem that too in the first submission itself!!
sir ek hi dil hai kitne baar jeetoge ❣
striver bhaiya when can we expect the strings playlist? ur explanation is far better than anyone else . and before the fanboys come at me saying that " striver has a job , have patience" , im just asking when we can expect not forcing him :)
no one explains better than you ,thank you
His efforts>>>>
Hats off to your hardwork brother 🤍🫡
Striver please please please Continue with the series ..... Placements are approaching , Completely dependent on ur way of teaching .....Kindly upload videos and complete dsa as early as possible
final year aswell?
Understood ❤ (1st and 2nd Approach)
This surely is an amazing problem
Can't thank you enough for this amazing content!! Explained so perfectly!! Thank you Striver for this course!!
Why are the videos not coming? please make a video regarding when the future videos will be released. I am very excited.
Amazing explanation so far🔥
Thank You Striver for the best explaination
Understood! Super amazing explanation as always, thank you very much for your effort!!
Amazing! Dedication is super! Thank you Striver!
Thank you for explaining this difficult question so brilliantly.
Very well understood all three approaches specially priority queue one method
Before Optimizing this with BS It was preety Easy to Solve but When it comes to furthur optimize,
the question changes it's difficulty to Hard
Nicely Explained
Thank You Bhai
Awesome explanation. still trying to absorb last approach
❗❗FOR THOSE who were not able to get why Striver has written the following line in the last approach:
if((arr[i] - arr[i - 1]) / dist) == numberInBetween * dist)
THIS IS A MISTAKE IT SHOULD BE:
if((arr[i] - arr[i - 1]) == numberInBetween * dist)
i.e if a = b / c, then for the confirmation you will do -> b == a * c, not b / c == a * c.
Thanks🙏🏻🙏🏻
did this question even before watching video. you taught binary search so good that I was able to do it so easily
Good explanation, please start string then linkedlist, also please add gfg links
Great Approach. Really loved the explanation. You made such an hard question easy to understand. Thanks❤❤
From Bruteforce -> better -> optimal. It was really hard question in BS. But anyways Thank You Striver for best explanation.
It's actually very interesting problem
I appreciate everything you're doing. However, my only suggestion is, can you keep dark mode while writing code.
Striver bhai plzz start string series i am waiting for it.... ❤️❤️❤️
awesome striver !
i have understand solution 2 and something something solution 3. you are pro God ❤❤
UnderStood Striver, and that's awesome. Thanks for making this
Thank you so much Striver.Loved it.💖
hats off to your efforts sir, very well explained
maybe high have to watch again after sometime awesome video
last wali ne dimaag hila daala bhai!!
Hats off to your hard work 🫡
Absolutely loving your SDE sheet ….please just make a video on Rabin Karp algo and KMP algo…thoda bouncer jara hai uska concepts.
Where can I find it ?
@@grette4156 search on google-striver sde sheet
True to your name, Striver.
private int noOfStationsRequired(int[] stations, double dist) {
int cnt = 0;
for(int i=0; i
watching this while I'm drunk ...great watch
Striver, you are my DRIVER💞
58:34 "If the interviewer doesn't agrees on that", ...................then tell him "bhar mai jao!"
just wow.. u really inspire me sir..
Hats off to the explanation. Awesome work sir
Plz bhaiya upload more and more videos as soon as possible......plz bhaiya
Th ode question khud se bhi try kiya karo 🥲
@@Daddy30011 not question bro.....I say introduction tutorial of pointer and some other
Striver you are GOD!!!
Love u bhaiya .....Thank u for hard work ♥
Stack & Queue Series Please Also Linked List.
I directly taught of BS solution, but loved you pq solution.
best video till date
A small improvement in brute force is u don't need to have a howmany vector u can use the pair in pq
Instead of checking if the mid exactly divides arr[i+1]-arr[i] or not, we can directly do ceil((arr[i+1]-arr[i]) / mid) - 1 to avoid that issue.
Bhai site thik kar rahe ho to sath me CN ki jagah GFG ki link dal do please...
Or you can make another section beside of CN links, for GFG links please 🥺
Bhai Will You Continue To Upload DSA COURSE VIDEOS AFTER BINARY SEARCH??? PLEASE UPLOAD STRING PLAYLIST BHAI
if Interviewer is asking for BS just say i'm done and move on
hey Striver , Just a Small request sir can pls give us the , List of Topics that you will be covering monthly
So it will easy for us to knew till when we are able to complete the dsa
Yes pls 😊
yes
Yesss please Striver
Hi, Striver I had asked you in your previous videos when to use while(high-low>1) like conditions. Put some light on it.🙂
I said repeatedly, we solve all the problems with while(low
I dont think we need the line
if((arr[i] - arr[i-1]) == (dist * numberInBetween)) {
numberInBetween--;
}
Beacause even if you remove this line of code, the code gets submitted. I think this is because if we dont have this line, the cnt will be overestimated and so it will automatically execute low=mid and in doing so, it will further execute the high=mid calls and we will reach a answer closer to the actual ans with diff less than 1e-6
Amazing content bro... Love you so much
Great video sir! Hats off!
Bayya please make sure in SDE sheet the you tube video should be play in other page when we click to watch
If we will make ans variable and try to return it as answer. It will not work in cases where the high itself is the answer , because the mid will never be equal to high , hence the no. of stations function will never return true , hence ans variable will never change . It will just return the value with which it was initialised.
bhaiya ....some game changer was coming on 22nd july
whats that
why is the site of takeyouforward down?? please fix it as soon as possible as many are using sde sheet and a2z sheet form there
bhai can yu tell how many month yu will take complete this course actually i am new this chanel approx 3 month
Sir what do you suggest if i am able to solve question from your sheet after looking at some part of videos or some discussion section of leetcode i mean i am not able to solve new questions by myself but after learning i am able to solve thosr types . So i was just wondering whether its right to look up at the solutions and learn from it or should give more time to solve questions by myself only ? Its a honest question i wish you can answer.
same case with me...i think we should just solve more and more problems(by looking at solution) until we get used to the pattern of solving the questions!
Very nice explanation
Bhaiya u got the ipad and you are great at explaining things..but its too tough to explain in interview in such a pressure situation😢
But try to give all the approach it will be the edge factor in the interview
Done! Nicely explained
at 36:50 line number 13, shouldn't it be
long double newSecLen = inDiff / (long double howMany[secInd]);
There is no need for a +1 because we already incremented howMany[secInd] at line number 11.
please striver post the next videos asap we are eagerly waiting for ur vds please, placement start ho gya please complete the series
hi I have solved your a to z sheet and it is a great help but recently you have removed the gfg links and I usually revise from the code that i have solved in the ide. please add the gfg links as well and do not remove the leetcode links. thanks
Bro can you send your wsp or tg account
you are great bhaiya love you❤
Madddd Respect man♥♥
bhaut hard bhaut hard
You are just awesome man👍
At 37:20, should we only need to insert only one part of the distance or all the parts of the distance, I mean, if there are gas stations at 1 and 13, when we place a new gas station at 7, we will have two distances now, right? 1 to 7 and 7 to 13. We need to insert both distances right. But we are only inserting one of them(Into the Priority Queue).
because we only wants the distance to check whether it is maximum or not. Since the all the distances in that particular range will be equal so taking only one distance is enough.