Detect and remove cycle

Why the cycle is not removed ?

@vaishnavtannu You are not using a correct approach for loop removal. From line 58 till next loop it might just go on infinity if they don’t not match. You have to first find the cycle lenght then move the slow pointer to the start and do the match .

https://ide.codingblocks.com/s/218114 I have made removeLoop function and called it if slow == fast. But still getting same output.

@vaishnavtannu Try returning that node from the function and update it.

https://ide.codingblocks.com/s/218114 Can you please check now. Its still not working.

Yes let me check. Were you able to count the length of the loop and delete it as I said before

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.