Given head, the head of a linked list, determine if the linked list has a cycle in it using Floyd's Tortoise and Hare.
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 in the linked list. Otherwise, return `false`.
Invariant: Modular gap (fast - slow) % C strictly decreases by 1 in each step.
Speed deltas eliminate auxiliary memory requirements in cycle detection.
Bottleneck: Avoids O(N) Hash Set memory allocation.
Given head, the head of a linked list, determine if the linked list has a cycle in it using Floyd's Tortoise and Hare.
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 in the linked list. Otherwise, return `false`.
Invariant: Modular gap (fast - slow) % C strictly decreases by 1 in each step.
Speed deltas eliminate auxiliary memory requirements in cycle detection.
Bottleneck: Avoids O(N) Hash Set memory allocation.
Initialized Floyd's Cycle-Finding Algorithm. Slow and Fast pointers start at head Node #0.