Doubt in explanation

We have given that at 2 as a input we have to consider 2 as kth element but it is showing k=3 in explanation

image

hello @anubhavb11
if u r talking about this ->
image
test case then here k is 3 only (check highlighted part)

code - https://ide.codingblocks.com/s/261273 giving tle

image

getting tle becuase you r running while loop infinite time.
u will be given only q queries , so run while only for q times.

also
use long long in place of int to avoid range overflow

test case 2 - wrong answer
code- https://ide.codingblocks.com/s/261279

image
declare them (highlighted part) as long long

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.