Linked list-K append

sir mera code dumped kaise ho raha hai
ye sublime toh sahi output de raha hai

@YASHMATHURIA123
remove the delete keyword lines.
This is a problem with online compilers sometimes, so better not to use delete if gettting error.

sir now it gives run error

@YASHMATHURIA123
For sample test case it is fine after removing that. If it is in other test cases There may be a mistake in code implementation.
are you talking about sample test case or other test cases?

test case show run error test case 2,3 ,4

@YASHMATHURIA123
you are not considering the cases when k >= n, in that case k will be k%n.
Also take care and check for corner case like k=n.

sir please update my code i can not undertand it

@YASHMATHURIA123
Also please mark the doubt as resolved if it is clear now.

@YASHMATHURIA123
ok wait for sometime. i will be doing it.

@YASHMATHURIA123
i hope the logic is clear for k=k%n, because if k is greater than n it will only mean the doing the append for remaining( k%n) elements
This is the code for the same.

sir agar k badhaa hoga list s toh ye toh valid question hi nahi

@YASHMATHURIA123
Actually that depends on the question, in the question it is given K can be greater than N. So what it will mean is,
Lets suppose list is: 1, 2, 3. here N=3.
then if k is 4, then it will mean ki pehle N elements ko append which is nothing but same as initial then uske baad k-N i.e. 1. so k=1 k lie solve karo. It will like doing this in a circular linked list

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.