How do you detect loops in linked list?
Anonymous
Using a fast and a slow pointer. A fast pointer jumps 2 nodes while a slow pointer jumps 1 node. If these pointer ever meet, then there is a loop in the linked list.
Check out your Company Bowl for anonymous work chats.