Why are we initializing end as stalls[n-1] -stalls[0] ?
Can it be stalls[n-1]? Or simply n-1?
Aggressive cows
end is initialized by maximum possible distance which can be stall[n-1]-stall[0].
Yes it can be stall[n-1] (when stall[0]>=0) but not n-1.
Binary search in smaller(inappropriate) range can affect answer.