Write a function. Test real cases. Improve your solution.
A calendar export contains unsorted busy windows [start, end], measured in integer minutes, with start < end. Return a new array of windows sorted by start, merging windows that overlap or touch. For example, [10,20] and [20,30] become [10,30]. Preserve gaps. Duplicate and nested windows are valid. Do not mutate the input array or its inner arrays. Negative minute values are allowed.
[
[
[
30,
45
],
[
10,
20
],
[
15,
35
]
]
][
[
10,
45
]
][
[
[
10,
20
],
[
20,
30
],
[
30,
40
]
]
][
[
10,
40
]
][
[
[
50,
60
],
[
10,
20
],
[
25,
30
]
]
][
[
10,
20
],
[
25,
30
],
[
50,
60
]
][
[
[
1,
10
],
[
2,
3
],
[
1,
10
],
[
4,
8
]
]
][
[
1,
10
]
][ [] ]
[]
[
[
[
-10,
-5
],
[
-5,
0
],
[
1,
2
]
]
][
[
-10,
0
],
[
1,
2
]
][
[
[
7,
12
]
]
][
[
7,
12
]
][
[
[
100,
110
],
[
2,
5
],
[
30,
35
]
]
][
[
2,
5
],
[
30,
35
],
[
100,
110
]
]Your code runs in your browser. These exercises use synchronous JavaScript functions and built-in data types; DOM access, network requests, and npm imports are unavailable. Runs stop after about four seconds. Test results support self-study and don’t certify proficiency.