A linked list is given as a list nxt, where nxt[i] is the index of the node after i, or -1 at the end. The list starts at node 0.
Implement find_cycle_start(nxt) using Floyd's tortoise-and-hare algorithm with O(1) extra memory: return the index of the node where the cycle begins, or -1 if there's no cycle. Then implement cycle_length(nxt) (0 if there's no cycle).
Then use the same idea on find_duplicate(nums): a list of n + 1 integers, each in 1..n, containing exactly one repeated value (possibly repeated many times). Treat nums as a function i → nums[i] and find the duplicate without modifying the list.