You are given a square matrix of size M × M.
Perform the following operations on the matrix:
Sort every row as follows:
Using the matrix obtained after Step 1, sort every column as follows:
Print the final matrix after both operations.
Print the transformed M × M matrix.
Each row should be printed on a new line with space-separated integers.
3
3 2 1
4 5 6
9 8 7
7 2 9
6 5 4
1 8 3
Original matrix
3 2 1
4 5 6
9 8 7
After row sorting
1 2 3
6 5 4
7 8 9
After column sorting
7 2 9
6 5 4
1 8 3
2
4 6
9 8
9 6
4 8
Jefeeerirs • Pending
Jefeeerirs • Pending
Jefeeerirs • Pending
Texas • Pending