Agressive cows problem


only two test cases pass
kindly help

Your mistake

int mid=s+e/2;

correct one:

int mid=(s+e)/2;

also use long long int as constraints are large
Constraints

2 <= N <= 100,000
0 <= xi <= 1,000,000,000
2 <= C <= N

Modified code

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.