Doubt sort game


what is wrong in this code and it is also showing time limit?

Two reasons mainly:
1] Your code uses ArrayList.remove() function which is linear in complexity. This makes the complexity of your code nn
2] You are sorting using Selection sort that has an asymptotic complexity of n
n.

Now, you could do this question using binary search. First sort all the members with their salaries and then find the index of the position using binarySearch.

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.