Please check my code:
3 out of 4 test cases are passing. Actually, I think the problem might be when k > n. Please suggest corrections.
Thanks in advance.
Please check my code:
3 out of 4 test cases are passing. Actually, I think the problem might be when k > n. Please suggest corrections.
Thanks in advance.
You have not included the case when k>N, thus in that case you cannot directly append, add the below lines and then try to submit your code
k=k%N;
if(k==0)
{
print(head);
}
else
{
head=append_nodes(head,k);
print(head);
}
Thanks I got it !!