Xtreme Labs interview question

Find if there is a loop in a link list

Interview Answer

Anonymous

12 May 2017

Check the length of the list, then iterate over each element while incrementing a counter. If the counter becomes larger than the length of the list, you have a loop.