Given a linked list (as an array with an optional `pos` indicating where the tail connects), determine if the linked list has a cycle in it.
> **Note:** For this problem, the input is a list of values and an integer `pos` (0-indexed). If `pos == -1`, there is no cycle. Otherwise, the last element points back to `pos`. Return `True` if a cycle exists, `False` otherwise.
Examples
Input
nums = [3,2,0,-4], pos = 1
Output
true
Tail connects to node at index 1 — cycle exists.
Input
nums = [1,2], pos = 0
Output
true
Tail connects to head — cycle exists.
Input
nums = [1], pos = -1
Output
false
No cycle.
Constraints
The number of nodes is in the range [0, 10^4].
-10^5 <= Node.val <= 10^5
pos is -1 or a valid index in the linked list.