solution for the problem of LinkedListCycleII