Code RoomMerge k schedules
HardPrep Room Coding #996

Merge k schedules

CodingAlgorithms & data structuresSenior–Staff~30 min

You are given k lists of intervals; within each list the intervals are sorted by start and are pairwise disjoint (each list represents a person's busy schedule). Merge all k schedules into a single list of disjoint busy intervals sorted by start, merging any that overlap or touch (touching means one ends exactly where another begins). Use a k-way merge with a heap rather than concatenating and re-sorting. Total intervals across all lists is up to 10^5. Each interval is [start, end] with start <= end. Return the merged list.

Implement
merge_k_schedules(schedules: list[list[list[int]]]) → list[list[int]]
Examples
in[[[[1,3],[6,7]],[[2,4]],[[2,5],[9,12]]]]out[[1,5],[6,7],[9,12]]
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 30 min
InputExpectedGot
[[[[1,3],[6,7]],[[2,4]],[[2,5],[9,12]]]][[1,5],[6,7],[9,12]]not run yetsample