2dbi
Home/Fastly/Reverse a Linked List
FFastly·DSASWE-2Onsite – Coding (Practical)

Reverse a Linked List

Problem

Reverse a singly linked list iteratively and recursively.

Example

1->2->3 => 3->2->1

Constraints

  • 0 ≤ nodes ≤ 5000

Approach

Three-pointer iterative; discuss recursion stack depth.

added 6 days ago
LeadersAccount