2dbi
Home/Fastly/Detect a Loop in a Linked List
FFastly·DSASWE-2Technical Phone Screen

Detect a Loop in a Linked List

Problem

Determine whether a singly linked list contains a cycle, in O(1) extra space, and return the cycle's start.

Example

Floyd's tortoise and hare

Constraints

  • 0 ≤ nodes ≤ 10^4

What Fastly looks for

Reported Fastly question. Explain the meeting-point math for the cycle start.

added 6 days ago
LeadersAccount