128. Linked List Cycle

EasyLinked List

Given head of a linked list, determine if the linked list has a cycle. Input: head array and pos (index where tail connects to). pos = -1 means no cycle.

Examples

Input: [3,2,0,-4,5,6] 2

Output: true

Explanation: Public test case for Linked List Cycle

Constraints

  • The number of nodes is in the range [0, 10^4]
  • -10^5 <= Node.val <= 10^5
Loading...

Run checks all cases above. Submit evaluates all test cases.