Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Middle of Linked List

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

Return the middle node's value (second middle if even length). Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement middle_node(values: list) returning the middle value of the list API linked list. For even length, return the second middle. ; [1, 2, 3, 4, 5, 6] → 4.

Constraints

  • Even length → second middle.

Examples

Input: middle_node([1, 2, 3, 4, 5]) Output: 3 Odd length middle.

Topics: lakebench, python, middle, two pointers.

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

intermediate

Middle of Linked List

Interview-style drill: Return the middle node's value (second middle if even length).

Implement `middle_node(values: list)` returning the middle value of the list API linked list. For even length, return the second middle. Example: `[1, 2, 3, 4, 5]` → `3`; `[1, 2, 3, 4, 5, 6]` → `4`. Keep the harness.