Detect cycle in linked list.
Detect cycle in linked list.
Approach: Use Floyd's cycle-finding algorithm.
Initialize slow = head, fast = head. While fast and fast.next: slow = slow.next; fast = fast.next.next; if slow == fast: return true. Return false.
Follow-up: Find start node of cycle.
Key concepts: two pointers, cycle detection, fast and slow.