Java 1ms - easy - line by line explanation
\nclass Solution {\n    public int[][] insert(int[][] intervals, int[] newInterval) {\n        \n        List<int[]> result = new ArrayList<>();\n        \n    
```\nclass Solution {\n    public int[][] insert(int[][] intervals, int[] newInterval) {\n        \n        List<int[]> result = new ArrayList<>();\n        \n        // Iterate through all slots\n        for(int[] slot : intervals)\n        {\n            \n            // if newInterval before slot insert newInterval & update slot as new interval\n            if(newInterval[1] < slot[0])\n            {\n                result.add(newInterval);\n                newInterval = slot;\n            } \n            \n            // if slot is lesser than new Interval insert slot\n            else if(slot[1] < newInterval[0])\n            {\n                result.add(slot);\n            } \n            \n            // if above conditions fail its an overlap since possibility of new interval existing in left & right of slot is checked\n            // update lowest of start & highest of end & not insert\n            else {\n                newInterval[0] = Math.min(newInterval[0],slot[0]);\n                newInterval[1] = Math.max(newInterval[1],slot[1]);\n            }\n        }\n        \n        // insert the last newInterval\n        result.add(newInterval);\n        \n        // convert to int[][] array\n        return result.toArray(new int[result.size()][]);\n    }\n}\n```
['Java']