Find the Cycle Entry
Medium · Linked Lists · about 20 minutes
Asked at Microsoft, Amazon, Google.
Given the head of a linked list, find the node where a cycle begins. Return that node's value (all values are distinct and non-negative), or -1 if there is no cycle. Use O(1) extra memory.