✅ [C++]Easy Intutive solution in O(NLogN) time complexity✅
Intuition\nIt is similar to the question Merge Intervals must try before doing this problem.\n\n# Approach\nInsert the new interval in and then the question bec
# Intuition\nIt is similar to the question [Merge Intervals](https://leetcode.com/problems/merge-intervals/) must try before doing this problem.\n\n# Approach\nInsert the new interval in and then the question becomes same as merge intervals.\n\n# Complexity\n- Time complexity:O(NLogN)\n\n- Space complexity:O(2*N)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {\n        intervals.push_back({newInterval});\n        sort(intervals.begin() , intervals.end());\n        int j = 0 , n = intervals.size();\n        for(int i = 1 ; i < n ; i++){\n            if(intervals[j][1] >= intervals[i][0]){\n                intervals[j][1] = max(intervals[j][1] , intervals[i][1]);\n            }\n            else{\n                j++;\n                intervals[j] = intervals[i];\n            }\n        }\n        vector<vector<int>> ans;\n        for(int i = 0 ; i <= j ; i++){\n            ans.push_back(intervals[i]);\n        }\n        return ans;\n    }\n};\n```\n*I just did this solution for doing it some other way and i know there exist a O(N) solution too*\n
['Sorting', 'C++']