Linked List-K Append

three test cases are giving run time error

@ayush1213
You have not worked for the testcases when K is greather than N.
Input :
7
1 2 2 1 8 5 6
10

Expected Output :
8 5 6 1 2 2 1

Consider taking the modulo of k with n.

@tarunluthra test case 2 is still giving runtime error code is

@ayush1213
Think about the case when k is a multiple of n. In that case k%n will be 0. Your code gives error in such cases. In cases like these , you don’t need to do anything and just print the list as it is.

thank u very much sir

@ayush1213
Please mark this doubt as Resolved in your Doubts section. If you are still facing any issue regarding this doubt though , let me know so I can help you out.

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.