[C++] | Clean and Commented with example | Explained | O(n) Time
*Explaination\n- 1st While loop to put all intervals that are to the left of the inserted interval. \n-  2nd While loop to merge all intervals that intersect wi
****Explaination****\n- **1st While loop** to put all intervals that are to the left of the inserted interval. \n-  **2nd While loop to** merge all intervals that intersect with the inserted interval.\n-  **3rd While loop** put all intervals that are to the right of the inserted interval.\n\n****Example****\nGiven [1,2],[3,5],[6,7],[8,10],[12,14], insert and merge [4,9] in as [1,2],[3,10],[12,14]\n![image](https://assets.leetcode.com/users/images/58677d7a-175e-4f97-ab36-44d01d3195e5_1599985042.67296.png)\n\n****Code****\n```\nclass Solution {\npublic:\n    vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {\n        vector<vector<int>> sol;\n        if(!size(intervals) and !size(newInterval)){\n            sol.push_back(newInterval);\n            return sol;\n        }\n        if(!size(intervals)){\n            sol.push_back(newInterval);\n            return(sol);\n        }\n        int i=0;\n        int start=newInterval[0];\n        int end=newInterval[1];\n\t\t//while #1 put all intervals that are to the left of the inserted interval. \n                while(i<size(intervals) and  intervals[i][1]<newInterval[0]) \n                    sol.push_back(intervals[i++]);\n\t\t//while #2 merge all intervals that intersect with the inserted interval.\n                while(i<size(intervals) and intervals[i][0]<=end){\n                    start = min(start, intervals[i][0]);\n                    end = max(end, intervals[i][1]);\n                    i++;\n                }\n                sol.push_back({start,end});\n\t//while #3 put all intervals that are to the right of the inserted interval.\n            while(i<size(intervals))\n                sol.push_back(intervals[i++]);\n        return sol;          \n    }\n};\n```\n****Complexity****\nO(n)
['Greedy', 'C']