Merge Overlapping Intervals

To merge overlapping intervals, we first sort with the start time. The intuition behind is that we have to merge what has started before and if it has any overlap.

After the sorting, its less work. We just have to see if the current event has overlap with the previous, if yes then merge, otherwise store it as non-overlapping event.