Q linklist k append
How to break the loop
why some test cases are showing run error
while (fast->next != NULL)
{
fast = fast->next;
slow = slow->next;
}
here you also have to check whether fast exist or not before using fast->next
like this
while (fast && fast->next != NULL)
{
fast = fast->next;
slow = slow->next;
}
even now test cases are showing run error
Modified Code
one more thing you have to handle
what if k>n??
then k should be k%n;
cin >> l;
if(l>=n)
l = l%n;
now it will pass all testcases
i have checked
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.
hi @hhiteshbansal_40d12e2460a1738e
I can see that u have successfully submitted the code and gained full score… is there still anything??
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.