Aggressive Cows


Which Test Case I am failing ??

I have edited your code… Try to submit it now…

What was wrong with my code ??

Which mistake I have done ?

There is a slight error in the bool function as you need to use the
if(count==cows) after line no 8 only…
and also initialise
int ans=-1
and also you will first sort and then initialise start and end values… else search space will be incorrect…