KINDLY CHECK WHY THE ALL TEST CASES ARE NOT PASSING? LINK TO THE CODE IS
Test case not passing
You need to add a condition to restrict the linked list that is to be appended
basically the linked list that needed to be appended has to be smaller than size of linked list so do a k%=len
and since in the append function there is no check for if( k != 0 )so that their is no run time error
updated the code after cin >> k to the lines i have mentioned below
k%=n;
if(k != 0 ){
node*kth=append(head,k,n);
print(kth);}
else
print(head);
you are saying we have to check if the k is less than the link list length that is n… in the int main i have added the condition that if(k<=n && k>0) { node*kth=append(head,k,n) }
you are saying we have to check if the k is less than the link list length that is n… in the int main i have added the condition that if(k<=n && k>0) { node*kth=append(head,k,n) }…this thing i feel is same as yours still its not working …here is the link to the code https://ide.codingblocks.com/s/196113
no no
like if k > n
then also u can append k%n nodes in the linked list
basically if len = 5 and k = 12 then that means 2 nodes need to be appended
ie k%n
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.