The problem. Given head, return the node where the cycle begins. If there is no cycle, return null. You must not modify the list.
Input: head = [3, 2, 0, -4], tail connects to index 1
Output: the node 2 (index 1)
Input: head = [1], no cycle
Output: nullThis builds directly on Linked List Cycle: first decide whether there's a loop, then find its entrance.
Free account
Sign up to read the rest of this lesson: 5 more sections, 2 drawings, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come