Linked List-K Append - compiler showing wrong answer even though it is correct

im getting the correct ansewr, but it is not accepting all the test cases.
i cant even access the test cases and editorial.

Hi Aman,
Please share the link to your code.

Hi Aman,
Your code will not work when k >= size of linked list and that’s why your are getting wrong answer. Suppose linked list is :
1 3 5 7 9
and k = 6
then you have to print
9 1 3 5 7

1 Like

You can check this code for value of k equal to or greater than length of Linked List.

even after making this change,one test case is still showing a run time error

i have posted the updated code above

Hi Aman,
Your code is not working when k = size of linked list.

1 Like

thank you- that solved it

Hi Aman

I am marking your doubt as resolved. If you face any error, feel free to reopen it.