2dbi
Home/Asana/Detect a Cycle in a Linked List
AAsana·DSASDE-2Technical Phone Screen

Detect a Cycle in a Linked List

Problem

Determine whether a singly linked list has a cycle, O(1) space; return the cycle start.

Example

Floyd's tortoise and hare

Constraints

  • 0 ≤ nodes ≤ 10^4

Note

Reported Asana phone-screen question.

added 6 days ago
LeadersAccount