All Questions
1 question
-1
votes
1
answer
196
views
Rotate a matrix in place, moving elements? (How to write a part of flow/logic after understanding the problem?)
Following is a java solution of the classic question of rotating a nxn matrix in place clockwise by 90 degrees.
public void rotate(int[][] matrix, int n) {
for (int layer = 0; layer < n / 2; ++...