ALGORITHMS

Given a square matrix of dimension N, Rotate the matrix clockwise/anti-clockwise. Example:

1   2   3   4                                      13  9   5   1
5   6   7   8           Rotating clockwise         14  10  6   2    
9   10  11  12          ------------------->       15  11  7   3
13  14  15  16                                     16  12  8   4

Continue reading...