Hi i coded solution and only one test case was passed so i unlocked the editorial and I faced an issue understanding it that why we used a vector to store all our kth node rather than normally print it
here is the code
DOubt in editorial given
Hi Deep,
so we are using a vector because we have to print the nodes in ascending order… so we sort them and print them…
also if vector is empty we have to print 0 as stated in ques… so these conditions would not have been satisfied by ur code…
u can refer my code also --> https://ide.codingblocks.com/s/623307
Hi deep,
is it clear now??
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.