javaScript solution beats 99.79%
\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    le
```\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    let size = intervals.length;\n    let index = 0;\n    let res = [];\n    \n    while(index < size && intervals[index][1] < newInterval[0]) {\n        res.push(intervals[index]);\n        index++;\n    }\n    while(index < size && intervals[index][0] <= newInterval[1]) {\n        newInterval[0] = Math.min(newInterval[0], intervals[index][0]);\n        newInterval[1] = Math.max(newInterval[1], intervals[index][1]);\n        index++;\n    }\n    res.push(newInterval);\n    while(index < size) {\n        res.push(intervals[index]);\n        index++;\n    }\n    return res;\n}\n```
[]