Find the largest element in each row of a 2x3 matrix {{3, 5, 1}, {7, 2, 8}}.
MediumProblem Statement
Find the largest element in each row of a 2x3 matrix {{3, 5, 1}, {7, 2, 8}}.
Sample Input
Matrix: 3 5 1 7 2 8
Sample Output
Max element in row 1: 5 Max element in row 2: 8
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
void maxInRows(int matrix[2][3]) {
// Your code here
}
int main() {
int matrix[2][3] = {{3, 5, 1}, {7, 2, 8}};
maxInRows(matrix);
return 0;
}
Input
Matrix: 3 5 1 7 2 8
Expected Output
Max element in row 1: 5 Max element in row 2: 8