code: https://ide.codingblocks.com/s/155616
what is wrong in my code. Please help not able to print the desired output.
Circular linked list
Hello @shashakchandel,
There is a problem with the logic of your found() and buildcycle() function.
I have modified your code:
Let me know if you donβt understand something.
Hope, this would help.
Give a like if you are satisfied.
thanks bro I understood my mistake but after modification also one test case is failing. Can u help me what that case is??
Hello @shashakchandel,
I have detected the case. But I would suggest you to modify the code yourself.
1 2 3 4 5 5 -1
Expected Output:
1 2 3 4 5
Actual Output:
1 2 3 4 5 5
Hope, this would help.
Give a like if you are satisfied.
code: https://ide.codingblocks.com/s/155770
I have made some modifications and my code is working for above test case bt still one test case is failing on submitting my code.Please help what is wrong in my code.
Hello @shashakchandel,
It is now failing for the case:
1 2 3 4 5 4 -1
bool found(node *head,node *temp,int data){
// modification:
while(temp!=head){
if(temp->data==data){
return true;
}
temp=temp->next;
}
return false;
}
This, is the modification you have to perform in your code.
Give a like, if you are satisfied.