Dsa
Matrix
Easy
Finding the Maximum in Each Column
Given a matrix of integers, write a program to find the maximum value in each column and print the results.
Input Format:
The first line contains two integers m and n (1 <= m, n <= 100).
Each of the next m lines contains n space-separated integers.
Output Format:
Print the maximum of each column on a new line, space-separated.
Example:
Input:
3 3
1 2 3
4 5 6
7 8 9
Output:
7 8 9
Key concepts
matrixmaximumcolumn
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