Kohl's Interview Question

Write code to tell if there is a loop in your linked list.

Interview Answer

Anonymous

Mar 9, 2016

Set two pointers to the head of a linked list. As you move along, increment one pointer twice as much as the other pointer. If they ever point to the same thing, you have a loop.