Amazon interview question

Find loop in a list