Visa Inc. Interview Question

How would you check that a LinkedList has a loop?

Interview Answer

Anonymous

Jan 21, 2016

Non-algorithmic solution is to use a HashSet. Algorithmic solution is to use two runner nodes at different traversal speeds.

1