Microsoft Interview Question
1,268 Interview Reviews |
Back to all Microsoft Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Development Engineer at Microsoft:
Diagonally flip a two dimensional array.
| Tags: | technical, array See more , See less 8 |
See more for this Microsoft Software Development Engineer Interview
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Gabriel:
Observation:
- in order to talk about diagonals in a two dimensional array, that means that we are dealing with a (n x n) array (square matrix)
Solution:
- flip on the first diagonal (i = j): (i, j) <->(j, i)
- flip on the second diagonal (i + j = n): (i,j) <-> (n - j, n - i)
To write the code should be straightforward. Be careful to flip only half of the matrix :) and not all the elements!