Aggrcow (concept doubt)

i m not able to understand the question even after watching the video of doubt session on youtube, can you please provide me some other video or expalin it.
i know binary searc will be used , but i m not able to implement it

We need to maximize the gap between two adjacent Cows kept in the yarn and return the minimum of all these maximums.

For example consider: 5 Array Elements as 1 2 8 4 9
And let’s say cows are 3.
The Final answer, here is 3.

Solution: As the farmer can put his 3 cows in the stalls at positions 1, 4 and 8,
resulting in a minimum distance of 3 among 3(4-1),4(8-4) being the adjacent distances among the 3 positions.

apply binary search on the search space(min value of ans, to max value of ans)
now you know lo and hi…calculate mid…decide according in binary search if the value of mid is feasible or not…

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.