Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Reverse Linked List

Python data engineering interview problem. Difficulty: intermediate. Pattern: Linked Lists. About 14 minutes. Part of the Pro drill bank.

Reverse a singly linked list represented as a Python list of values. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement reverse_list(values: list) -> list reversing the order of values (list API for a linked list).

Requirements

  • Empty list returns [].
  • Do not mutate the caller's list unless you copy first.

Examples

Input: reverse_list([1, 2, 3, 4, 5]) Output: [5, 4, 3, 2, 1] Head becomes the old tail.

Topics: lakebench, python, reverse, list api.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Reverse Linked List

Interview-style drill: Reverse a singly linked list represented as a Python list of values.

Implement `reverse_list(values: list) -> list` reversing the order of values (list API for a linked list). Example: `[1, 2, 3, 4, 5]` → `[5, 4, 3, 2, 1]`. Keep the harness.