Code Room
CodingMediumcod-g782
Subject Linked listsLevel Entry–Mid~20 minCommon in Distributed systems · Algorithms & data structures interviewsIndustries Software development

Question

Given a singly linked list as a plain list of values, group all nodes at odd positions together followed by the nodes at even positions, preserving the relative order within each group. Positions are 1-indexed (first node is odd). Return the reordered list of values. The list may be empty.

Implement
odd_even_list(values: list[int]) → list[int]
Examples
in[[1,2,3,4,5]]out[1,3,5,2,4]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.