Code Room
CodingHard
Question
Sort a singly linked list in ascending order, given as a Python list of integers, and return the sorted sequence as a Python list. You are expected to design an O(n log n) approach appropriate to a linked list (i.e. merge sort, not a comparison sort that needs random access). The list has 0 to 5*10^4 nodes and values fit in 32-bit signed range.
Implement
sort_linked_list(values: list[int]) → list[int]Examples
in
[[4,2,1,3]]out[1,2,3,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.
Learn the concepts
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.