Решение на задача 11. Reverse Matrix Diagonals 1 от Java Advance
Здравейте,
търся решение на задачата Reverse Matrix Diagonals, много ме затрудни, видях едно решение във форума, но търся друго.
Това е условието на задачата:
11. Reverse Matrix Diagonals
You are given a matrix (2D array) of integers. You have to print the matrix diagonal but in reversed order. Print each diagonal on a new line.
Input
On the first line, single integer the number R of rows in the matrix. On each of the next R lines, C numbers are separated by single spaces. Note that R and C may have different values.
Output
The output should consist of R lines, each consisting of exactly C characters, separated by spaces, representing the matrix diagonals reversed.
Constraints
All the integers will be in the range [1….1000].
Examples
Input
3 4
21 20 18 15
19 17 14 12
16 13 11 10
Output:
10
11 12
13 14 15
16 17 18
19 20
21
Input:
1 3
3 2 1
Output:
1
2
3
Благодаря!