Given `head`, the head of a linked list, determine if the linked list has a cycle in it. Return `true` if there is a cycle; otherwise, return `false`. Example: Input: head = [3,2,0,-4], pos = 1 Output: true Explanation: There is a cycle where tail connects to index 1. Pattern focus: Fast and Slow Pointers.
head = ListNode
return boolean
Example 1:
Input:
head = [1,2]
Output:
false
Example 2:
Input:
head = [1]
Output:
false
Example 3:
Input:
head = [3,2,0]
Output:
false