solution to Merge Intervals