Diagonally flip a two dimensional array.
Anoniem
I will not write the code I will just post the solution. The code is straightforward. 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!