Guidewire Interview Question: How would you find out if a l... | Glassdoor.ie

Interview Question

Java Developer Interview Dublin, Co. Dublin

How would you find out if a linked list contains a loop?

Answer

Interview Answer

1 Answer

0

Have two iterators of the list, one moving two nodes each time, the other one node at a time. If they two instances are the same at any point, there is a loop.

Interview Candidate on 30 Apr 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.