Loading...
Given a list and a pos (0-indexed position where the tail connects to form a cycle), return True if there is a cycle, False otherwise. pos = -1 means no cycle.
3,2,0,-4 1
True
pos = 1 indicates that the tail of the list connects to the node at index 1, forming a cycle: 3→2→0→−4→2.True.