Another approach

Can we iterate from 0 to n-k+1 and print the data of n-k+1 th node from the beginning. Will it also give the same answer

@hemantomer1 ofcourse, there can be multiple ways to solve the same problem, you can use whatever approach you are comfortable with.
Please mark the doubt as resolved if you dont have any further queries.

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.