Very simple JavaScript O(n) solution
\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    co
```\n/**\n * @param {number[][]} intervals\n * @param {number[]} newInterval\n * @return {number[][]}\n */\nvar insert = function(intervals, newInterval) {\n    const result = [];\n    \n    for (let i = 0; i < intervals.length; i++) {\n        let interval = intervals[i];\n        \n        // If overlaps\n        if (Math.max(interval[0], newInterval[0]) <= Math.min(interval[1], newInterval[1])) {\n            newInterval = [Math.min(interval[0], newInterval[0]), Math.max(interval[1], newInterval[1])];\n            continue;\n        }\n        \n        // If lower\n        if (interval[0] > newInterval[1]) {\n            result.push(newInterval, ...intervals.slice(i));\n            return result;\n        }\n        \n        result.push(interval);\n    }\n    \n    result.push(newInterval);\n    return result;\n};\n```
['JavaScript']