Solution for matrix rotation problemotd.