Why is Mercury both one of the hottest and one of the coldest planets in the solar system?

I would say - it is KNOWN that Mercury rotates only once in about 58.6 Earth days. So, for many days, one side is facing the Sun with the little planet having a backside that is frozen - fire on one side and ice on t'other.

Also, there's no atmosphere and no oceans to spread heat to the "dark side".