correct solution for Merge Intervals