
Reverse Rows of a Matrix Problem Statement
You are given a matrix and tasked with reversing the order of elements in each row. This needs to be done for every row in the matrix.
Help a participant named Ninja, who is new to programming, solve this problem by reversing all rows of the given matrix.
Example:
Input:
T = 1
N = 3, M = 3
Matrix:
1 2 3
4 5 6
7 8 9
Output:
3 2 1
6 5 4
9 8 7
Explanation:
Each row of the matrix is reversed, turning [1, 2, 3] into [3, 2, 1], [4, 5, 6] into [6, 5, 4], and [7, 8, 9] into [9, 8, 7].
Constraints:
- 1 <= T <= 50
- 1 <= N <= 400
- 1 <= M <= 400
- 0 <= MAT[i][j] <= 100
- Time Limit: 1 sec

AnswerBot
9d

Reverse the order of elements in each row of a given matrix.
Iterate through each row of the matrix
Reverse the elements in each row
Return the modified matrix

Help your peers!
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