Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?
Example
1
2
3
4
5
6
7
8
9
10
11
12
| Example 1 Example 2 INPUT >> OUTPUT | INPUT >> OUTPUT | 4 | 4 | 1 2 3 4 1 1 1 1 | 11 12 13 14 41 31 21 11 | 1 2 3 4 2 2 2 2 | 21 22 23 24 42 32 22 12 | 1 2 3 4 3 3 3 3 | 31 32 33 34 43 33 23 13 | 1 2 3 4 4 4 4 4 | 41 42 43 44 44 34 24 14 |
http://k2code.blogspot.in/2014/03/rotate-n-n-matrix-by-90-degrees.html
http://www.geeksforgeeks.org/turn-an-image-by-90-degree/
http://www.programcreek.com/2013/01/leetcode-rotate-image-java/
No comments:
Post a Comment