This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingTrack parents as you dive; an already-visited neighbour that is not the parent closes a cycle.
What this asks
Tell whether an undirected graph contains a cycle.
Track the parent on the way down: a visited neighbour that is not the parent closes a cycle.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing