why last = mid ? it should be last = mid - 1 and can we take init as arr[0] or not
Aggressive cows
Yes, it should be mid-1 and we can not take init as arr[0] ,lets see a example :
3 3 // no of stalls and number of cows
3 5 7 // stall coordinaters
u will get not get ans as the answer should be 2 but u have set range in 3 to 5
In case of any doubt feel free to ask 
If you got the answer then mark your doubt as resolved
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.