Code Room
CodingMediumcod-g1455
Subject IntervalsLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A parking app records reservations for one space as [start, end] hour pairs, treated as closed ranges. Reservations that overlap or touch — one ends exactly when another starts — belong to the same continuous occupied block. Given an unsorted list, merge it and return the occupied blocks as [start, end] pairs sorted by start. Example: [[8,10],[1,3],[2,6]] becomes [[1,6],[8,10]].

Implement
merge_reservations(reservations: list[list[int]]) → list[list[int]]
Examples
in[[[8,10],[1,3],[2,6]]]out[[1,6],[8,10]]
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.