Interview Questions

235. There is an array A[N][M] =... .....

Microsoft Interview Questions and Answers


(Continued from previous question...)

235. There is an array A[N][M] =... .....

Question:
Q. There is an array
A[N][M] =
1 2 3
4 5 6

The array is rotated so that
A'[M][N] =
3 6
2 5
1 4

is obtained.
Establish the relation between A and A' by using i, j, M, N

A[i][j] = A'[_][_]


maybe an answer:


A[i][j] = A'[M-j-1][i] or
A[i][j] = A'[2-j][i]

(Continued on next question...)

Other Interview Questions