Aggressive cows doubt

This is my code, but I am getting output as 1 .Why?

hello @ayushtiwari12 please wait i will go through your code and let you know the mistake .

hello @ayushtiwari12 i have corrected the code and now it is producing the correct answer .


the only mistake was that you were not sorting the array before applying the binary search .
Happy Learning !!

Thankyou, Now I got it.

hey @ayushtiwari12 please mark this doubt as resolved and do give the star rating .