Please help in this one.
Any other method as it is taking very less time.
Please tell the method which you think while seeing the Question other than Brute force.
Please help in this one.
Any other method as it is taking very less time.
Please tell the method which you think while seeing the Question other than Brute force.
Hey @cbcao263
Sort ‘arr2’ and apply binary search on it to get the nearest element for each element in arr1.
It gives a time complexity of O(nlogn)
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.
Bro, Yeh Question kaise krenge
idk why kyu galti aarhi.