Given a list of intervals [start, end], merge all overlapping intervals and return the result sorted by start time.
Follow-up: how would you handle a stream of intervals that arrive out of order?