Circular linked list problem

https://ide.geeksforgeeks.org/Fhxo3a7qnR-----what’s the error in my code i m not able to remove the loop

@AbhishekAhlawat1102 ,
There is an error in removeLoop method.

  1. Count the number of nodes in loop. Let the count be k.
  2. Fix one pointer to the head and another to kth node from head.
  3. Move both pointers at the same pace, they will meet at loop starting node.
  4. Get pointer to the last node of loop and make next of it as NULL.

what is the kth node from head u r talking about is it the node where loop exits?

@AbhishekAhlawat1102,
K is the number of nodes in loop.
Example:
4 nodes in loop. Now you have to go to the 4th node from head.

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.