can we do it like first we sort the array of index of stalls then divide it by no of cows for eg if we have 4 cows then divide no of stalls by 4 and start assigning in the sorted array from beginning of index array at the step of what we get by dividing by 4
Aggressive cows problem
In this case we would not get optimal distance, as all the stall are not evenly spaced, suppose we have stalls at 1,2,3,7,20,30 and we have 3 cows. You can easily see your way will fail.
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.