Reverse the rows of a matrix
As a part of its annual techno-cultural fest, NinjaCity will conduct a technical event, Decode, where it has given a matrix, and the participants have to decode it.
The participants are given a N*M matrix; they need to print the rows in reverse order. Do this for every row.
Among the participants, a participant named Ninja is new to programming and doesn’t have much experience; he asks you to solve the problem. Can you help Ninja reverse all the rows in reverse order?
Input Format:
The first line of input contains an integer ‘T,’ denoting the number of test cases. The test cases follow.
The first line of each test case contains two numbers ‘N’ and ‘M’, denoting the number of rows and columns in the matrix.
The following ‘N’ lines of each test case contain ‘M’ integers of every row (separated by space).
Output Format:
For each test case, print 'N' lines with each line consisting of 'M' integers. (row elements separated by space)
Print the output of each test case in a separate line.
Note:
You are not required to print the expected output; it has already been taken care of. Just implement the function.
Constraints:
1 <= T <= 50
1 <= N <= 400
1 <= M <= 400
0 <= MAT[i][j] <= 100
Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
Top Jio Platforms Backend Developer interview questions & answers
Popular interview questions of Backend Developer
>
Jio Platforms Backend Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app