Merge Intervals

Solution Code

Time Complexity

O(N^2) (checking all pairs).

Space Complexity

O(log N)