This greedy algorithm is actually very hard to prove.
For example, assume the current heap stores interval [0, 10].
If the first upcoming interval is [10, 20] and the second upcoming interval is [12, 15].
From a greedy perspective, we prefer appending [12, 15] instead of [10, 20] because it has a earlier end time 15 rather than 20 so that the further upcoming intervals have a higher probability to be merged. But in this solution we simply append [10, 20] to [0, 10], in which the correctness needs to be proved.
Although it works pretty well, I recommend to consider this problem as finding the maximum overlapped intervals.