Java || Greedy
\nclass Solution {\n    public int[][] insert(int[][] intervals, int[] newInterval) {\n        \n        List<int[]> ans = new ArrayList<>();\n        \n       
```\nclass Solution {\n    public int[][] insert(int[][] intervals, int[] newInterval) {\n        \n        List<int[]> ans = new ArrayList<>();\n        \n        for(int[] in: intervals){\n            if(in[1] < newInterval[0]){\n                ans.add(in);\n            }\n            else if(in[0] > newInterval[1]){\n                ans.add(newInterval);\n                newInterval = in;\n            }\n            else{\n                newInterval[0] = Math.min(newInterval[0], in[0]);\n                newInterval[1] = Math.max(newInterval[1], in[1]);\n            }\n        }\n        \n        ans.add(newInterval);\n        \n        return ans.toArray(new int[ans.size()][]);\n    }\n}\n```
['Greedy', 'Java']