Kindly have a look at my code as I am facing TLE with my code. What shall I do to optimize it ?
Aggressive Cows - TLE
Change the ArrayList to an array. ArrayList operations are very time-costly.
Firstly I need to sort the array which also gave TLE when I submitted.
Ok , I got the answer
Actually in Binary Search if count >= cows then I need to substitute lo = mid + 1
But what I did was when count == cows then lo = mid + 1
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.