...

/

Linked List Cycle

Linked List Cycle

Try to solve the Linked List Cycle problem.

Statement

Check whether or not a linked list contains a cycle. If a cycle exists, return TRUE. Otherwise, return FALSE. The cycle means that at least one node can be reached again by traversing the next pointer.

Constraints:

Let n be the number of nodes in a linked list.

  • 0≤0\leq n ≤500\leq500
  • −105≤-10^5 \leq Node.data ≤105\leq 10^5

Examples