Dsa
Matrix
Warm-up
Max in Each Row
Write a function that finds the maximum value in each row of a matrix. The input consists of two integers m and n (the dimensions of the matrix) followed by m lines of space-separated integers representing the matrix. Output the maximum values, each on a new line.
Example:
Input:
2 3
1 2 3
4 5 6
Output:
3
6
Key concepts
matrixmaxarray
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now