2dbi
Home/Akamai/Reverse a Linked List / Detect Cycle
AAkamai·DSASWE-2Technical Phone Screen

Reverse a Linked List / Detect Cycle

Problem

Reverse a singly linked list and detect whether it has a cycle.

Example

1->2->3 => 3->2->1; cycle via Floyd

Constraints

  • 0 ≤ nodes ≤ 10^4

Approach

Classic pointer manipulation; Akamai probes linked-list and memory questions.

added 6 days ago
LeadersAccount