Short and straight-forward Java solution
Hi guys!\n\nHere's a pretty straight-forward and concise solution below.\n\n    public List insert(List intervals, Interval newInterval) {\n        List result 
Hi guys!\n\nHere's a pretty straight-forward and concise solution below.\n\n    public List<Interval> insert(List<Interval> intervals, Interval newInterval) {\n        List<Interval> result = new LinkedList<>();\n        int i = 0;\n        // add all the intervals ending before newInterval starts\n        while (i < intervals.size() && intervals.get(i).end < newInterval.start)\n            result.add(intervals.get(i++));\n        // merge all overlapping intervals to one considering newInterval\n        while (i < intervals.size() && intervals.get(i).start <= newInterval.end) {\n            newInterval = new Interval( // we could mutate newInterval here also\n                    Math.min(newInterval.start, intervals.get(i).start),\n                    Math.max(newInterval.end, intervals.get(i).end));\n            i++;\n        }\n        result.add(newInterval); // add the union of intervals we got\n        // add all the rest\n        while (i < intervals.size()) result.add(intervals.get(i++)); \n        return result;\n    }\n\nHope it helps.
['Java']