I am not able to get the solution

https://ide.codingblocks.com/s/214567… plz help with the code… I am not able to find the bug

@dhirenkinha you are not returning anything in the append function.

https://ide.codingblocks.com/s/214567… still it is showing compilation error… plz help me with the code

@dhirenkinha dont pass head by reference in the print function, it will change the whole list. Secondly, order of input is wrong. You have to take n, n inputs, and THEN, the key. I have made some changes here https://ide.codingblocks.com/s/215641

Note that you are appending one element less than required, ie if 3 elements need to be appended, this code is appending only 2. Also, you haven’t considered the scenario where k > n

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.