what is the time complexity of this problem if we apply brute force to solve it.how to derive that.discuss the approach.
Time complexity issue
Hi @Rj.25
this is a greedy problem.
Time complexity will approximately be O(nlogn)
first u will sort both the array (white/black ball position)
then iterate through array and pair elements of both the array.
eh.
w={1,2,3}
b={4,5,6}
pairs will be (1,4),(2,5),(3,6)
Hope dis helps
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.