Your question is Write and Test a Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Turing Mobile receives availability windows during which a mobile workflow may run. Given a collection of time intervals, merge every overlapping or adjacent interval so the result contains the fewest possible non-overlapping windows.
Implement merge_mobile_windows(windows), where windows is a list of intervals. Each interval is represented as a two-element list [start, end], with integer time values and start <= end. Return a new list of merged intervals sorted by start. Intervals that overlap or touch, such as [1, 3] and [3, 5], must be merged into [1, 5]. Do not mutate the input list.
def merge_mobile_windows(windows):