Question solution and application of binary search as to why binary search was applied unclear.
Agressive cows question explanation
hello @sardanarishika
ley say x is the answer for this problem.
that is x is the minimum largest disantce to place c cows.
then it is possible to place all cows with with minimum distance of x-1 or x-2 or x-3 …1 right?
this makes our range monotonic and thats why we use binary search
{… . . . . . . . .x}| {x+1… }
{yes yes yes } | { no no no } <- check the search space it is monotonic
can you please explain it in detail?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.