Linked list K Append(timelimit exceeded)

Hello @Saksham12,

Your code if failing for two type of test cases:

  1. When k=0
  2. When k>=n (please, read the question carefully)

Try to correct it.
Let me know if you face any issue.

Hope this would help.
Give a like if you are satisfied.

Ok for k<=0 I can just return but what for k>=n

Hey @Saksham12,

To handle the case k>=n,
you can use the following statement:
k=k%n;
Reason:
0 and n has same output.
1 and n+1 has same output.
Same pattern has been followed.

Hope, this would help.

1 Like

Thanks for giving the right logic

Anytime @Saksham12,

Please, mark it as resolved.

Already resolved the problem