DEV Community

Reaper
Reaper

Posted on

Linked List Cycle-II #142

So basically use slow and fast pointers to detect cycle if slow pointer and fast pointer meet each other it means there's a cycle.

and after that to determine the starting of the cycle, just start a pointer from the head and move it until its not equal to the slow pointer, ps: move both slow and start pointer altogether until they meet

when they meet return either of them!

Top comments (0)