Merge Intervals (LC #56) is Meta's most asked sorting problem. Sort intervals by start time. Iterate through, merging overlapping intervals: if current start is less than or equal to previous end, extend the previous end to max of both ends. Otherwise, add current as a new interval. This runs in time due to sorting and space for output. Meta asks a critical variant: merge two interval lists instead of one. Use two pointers, always processing the interval with smaller start.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/sorting-searching/merge-intervals
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████████