addNum
is called:
a. Check if the number merges with the interval to its left or right.
b. If it merges with both, remove the right interval and update the left interval to cover both.
c. If it merges with one, update the corresponding interval.
d. If it doesn't merge, insert it as a new interval.getIntervals
is called, return all intervals in the TreeMap as a list.