slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
Use it when determining:
- is there a cycle?
- Where the cycle starts?
- Where is the middle of the Linked List?
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
Use it when determining: