Pergunta de entrevista da empresa BlueMessaging

How would you know if there's a loop inside a single-linked list?

Resposta da entrevista

Sigiloso

8 de set. de 2015

Use two pointers that iterate through the list: one checking one node at a time and one checking every two nodes. If they meet at any moment, it means there's a loop inside the list.