Pregunta de entrevista de Amazon

Write a program to fina a loop in a linked list

Respuesta de la entrevista

Anónimo

15 sep 2010

Have two pointers one is fast (2 steps at a time) and the other is slow (1 steps at a time). If at any moment fast == slow you have a cycle. Otherwise there is no cycle when fast hits the null.