Input: [[1,5]], [0,0]

Output: [[1,5],[0,0]]

Expected: [[0,0],[1,5]]

My code is as follows:

```
class Solution {
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
int left=newInterval.start;
int right=newInterval.end;
vector<Interval> result;
for(int i=0;i<intervals.size();i++)
{
if(right<intervals[i].start||left>intervals[i].end)
result.push_back(intervals[i]);
else
{
if(intervals[i].start<left)
left=intervals[i].start;
if(intervals[i].end>right)
right=intervals[i].end;
}
}
result.push_back(Interval(left,right));
return result;
}
};
```