Aggresive cow brute force

please review my code i tried aggressive cow problem in brute force way and failing two test-cases…

please provide necessary edit

@Diwyanshu hey you are using brute force thats why it is not passing,it is qdtn of binary search,try using it with binary search.

can you review my brute force method is it correct or not ???
it will be great help
thank you

@Diwyanshu hey please tell me your approach please ,as brute force will be like this take max and minimum distance and arrange cows one by one ,this us brute force.


please review this brute force approach

@Diwyanshu hey bro ,I am asking about your logic what you have applied in code then I will help you out.

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.