LinkedList-Kappend

My code is neither getting submitted, nor showing any error.
here’s the id-https://ide.codingblocks.com/s/194634

Hello @nikitaguptanikki2,

Your code is failing for the testcases with k>=N.
Example:
7
1 2 2 1 8 5 6
8
Expected Output:
6 1 2 2 1 8 5
Your Output:
1 2 2 1 8 5 6
Observation:
The required output is the same as that of k=1.
Similarly,
for k=7 the output is the same as that of k=0.
for k=9 the output is the same as that of k=2.
Solution:
k = k%n;
this would limit the value of k within the range [0,n-1]
To handle the case of k=0. Just print the array as it is.

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

1 Like

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.