Given:
intervals
where intervals[i] = [start_i, end_i]newInterval = [start, end]
Insert newInterval into intervals such that:
Constraints:
Examples:
// Example 1: console.log(insert([[1,3],[4,6]], [2,5])); // Output: [[1,6]] // Explanation: [2,5] overlaps with both intervals // Example 2: console.log(insert([[1,2],[3,5],[9,10]], [6,7])); // Output: [[1,2],[3,5],[6,7],[9,10]] // Explanation: [6,7] fits between existing intervals