Java Solution
public int[] printZMatrix(int[][] matrix) {
if (matrix == null || matrix.length == 0
|| matrix[0] == null || matrix[0].length == 0) {
return new int[0];
}
int row = matrix.length;
int col = matrix[0].length;
int[] res = new int[row * col];
int lvl = 0;
int next = 0;
while (next = 0 && lvl - j = 0 && lvl - j < row; j--) {
res[next++] = matrix[lvl - j][j];
}
}
lvl++;
}
return res;
}