Code RoomOdd even linked list
MediumPrep Room Coding #1345

Odd even linked list

CodingDistributed systemsAlgorithms & data structuresEntry–Mid~20 min

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.

0:00 of about 20 min
InputExpectedGot
[[1,2,3,4,5]][1,3,5,2,4]not run yetsample