merge intervals solution