Question d’entretien chez American Express

How do you detect a cycle in a singly linked list?

Réponse à la question d'entretien

Utilisateur anonyme

23 janv. 2026

use the tortoise and hare method. Slow pointer should move one tile at a time and the fast pointer moves two tiles. If the fast pointer catches up to the slow pointer then there is a cycle but if the fast pointer reaches null, there is no cycle.