Transpose of a matrix(Contest)
Transpose of a matrix easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Transpose of a matrix easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Write a program that creates an N*N matrix. Fill each cell with the sum of row number and column number (based on 0 indexes, ie indices begin from base 0), take its transpose and print it. Where the transpose of a matrix is a new matrix whose rows and the columns are interchanged to that of original matrix. Input Input contains a single integer N.
Constraints:- 1<=N<=500 Output Print the NxN matrix. Example Sample input 2
Sample output 0 1 1 2
Explanation:- 0+0 0+1 1+0 1+1
Sample Input:- 3
Sample Output:- 0 1 2 1 2 3 2 3 4
link: