Insert interval into calendar
Your task
A scheduling assistant stores a person's calendar as busy blocks [start, end] in minutes, closed ranges, non-overlapping, sorted by start. A new busy block arrives. Add it to the calendar, merging it with every existing block it overlaps or touches, and return the updated calendar sorted by start. Example: calendar [[60,90],[150,180]] plus block [85,120] becomes [[60,120],[150,180]].
Examples
insert_busy_block(calendar: list[list[int]], block: list[int]) -> list[list[int]]Example 1
Input
insert_busy_block([[60, 90], [150, 180]], [85, 120])Output
[[60, 120], [150, 180]]