better solution than Solution.java; leverage a cyclic linked list