99.16% faster | proper explaination| c++ solution| O(N)
Here 3 cases will arive:\n1) Non Overlapping intervals before given newInterval -> push into the ans vector \n2) Overlapping of intervals and newInterval update
Here 3 cases will arive:\n1) ***Non Overlapping intervals before given newInterval*** -> push into the ans vector \n2) **Overlapping of intervals and newInterval** update new interval \n   starting point of newInterval will be min of the interval starting point \n   or starting point of newInterval\n   Ending point will be the max of interval ending point or newInterval          end point.\n3) **Non overlapping intervals after the newintervals have been merged** ->    push ito ans vector   \n   \n**Time complexity - O(N)** \n**space complexity - O(1)**\n\nAlso, please do not use sorting algo here because we have already provided with sorted list.\n\n```\nclass Solution {\npublic:\n   vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {\n        int n = intervals.size(), i = 0;\n        vector<vector<int>> res;\n        //case 1: no overlapping case before the merge intervals\n\t\t//compare ending point of intervals to starting point of newInterval\n        while(i < n && intervals[i][1] < newInterval[0]){\n            res.push_back(intervals[i]);\n            i++;\n        }                           \n\t\t//case 2: overlapping case and merging of intervals\n        while(i < n && newInterval[1] >= intervals[i][0]){\n            newInterval[0] = min(newInterval[0], intervals[i][0]);\n            newInterval[1] = max(newInterval[1], intervals[i][1]);\n            i++;\n        }\n        res.push_back(newInterval);\n        // case 3: no overlapping of intervals after newinterval being merged\n        while(i < n){\n            res.push_back(intervals[i]);\n            i++;\n        }\n        return res;\n    }\n};\n```\n**Please upvote and comment if have doubt**
['C', 'C++']