Pergunta de entrevista da empresa Apple

How do you detect loops in linked list?

Resposta da entrevista

Sigiloso

3 de jun. de 2016

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.

5