Rotate a 2D array without using extra space
Given a N x N 2D matrix Arr representing an image. Rotate the image by 90 degrees (anti-clockwise). You need to do this in place. Note that if you end up using an additional array, you will only receive partial score.
- Time : O(n^2)
- Space : O(1)
c++
1 | class Solution{ |