

In Aptive Environmental scheduling, a common algorithm merges overlapping technician service windows. Write a function that takes a list of time intervals and returns a new list with all overlapping intervals merged.
Implement a function merge_service_windows(windows) where:
windows, a list of intervals, where each interval is a list [start, end] of integers.Two intervals overlap if the next interval's start is less than or equal to the current merged interval's end.
Example 1
windows = [[1,3],[2,6],[8,10],[15,18]][[1,6],[8,10],[15,18]][1,3] and [2,6] overlap, so they merge into [1,6].Example 2
windows = [[1,4],[4,5]][[1,5]]0 <= len(windows) <= 10^4windows[i].length == 2-10^9 <= start <= end <= 10^9After implementing the algorithm, write a comprehensive unit test suite. Your tests should verify correctness for normal cases, edge cases, and failure-prone boundaries such as empty input, single intervals, nested intervals, duplicate intervals, and endpoint-touching merges.
windows = [[1,3],[2,6],[8,10],[15,18]]Output[[1,6],[8,10],[15,18]]WhyThe first two intervals overlap and merge into `[1,6]`; the others remain separate.windows = [[1,4],[4,5]]Output[[1,5]]WhyBecause touching endpoints count as overlap, `[1,4]` and `[4,5]` merge.windows = [[5,7],[1,2],[2,4]]Output[[1,4],[5,7]]WhyThe input is unsorted, so sorting is required before merging `[1,2]` and `[2,4]`.0 <= len(windows) <= 10^4Each interval has exactly 2 integers-10^9 <= start <= end <= 10^9The input list may be unsorteddef merge_service_windows(windows):