Pergunta de entrevista da empresa Amazon

Write a program to fina a loop in a linked list

Resposta da entrevista

Sigiloso

15 de set. de 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.