test cases are not passing…
Aggressive cows prob
Your code is correct, but one thing you are missing here is that it is not given whether the given array is sorted or not sorted, so you must sort the array before applying binary search.
There may be cases when the element at higher index have lesser value which means it is located before some previous elements.
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.