Amdocs Interview Question

Write a program that detects a circle list