Rotate Image

You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
It is trivial when extra spaces are allowed.
Without extra space, we need to rotate the matrix from the outer layer to inner layer. Still not difficult but take some time to think about it.

Comments

Popular posts from this blog

Maximum Gap

[ITint5] Maximum Subarray for a Circular Array

[CC150] Chapter 8 Object-Oriented Design