Given a matrix, the task is to find the maximum element of each column.
Input: [1, 2, 3] [1, 4, 9] [76, 34, 21] Output: 76 34 21 Input: [1, 2, 3, 21] [12, 1, 65, 9] [1, 56, 34, 2] Output: 12 56 65 21
Approach: The idea is to run the loop for no_of_cols. Check each element inside the column and find for the maximum element. Finally, print the element.
Below is the implementation of the above approach:
76 34 21 11
Time Complexity : O(n * m), Here n is No. of Rows and m is No. of Colum.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Replace every matrix element with maximum of GCD of row or column
- Find column with maximum sum in a Matrix
- Find the original matrix when largest element in a row and a column are given
- Find pair with maximum difference in any column of a Matrix
- Find maximum element of each row in a matrix
- Program to find the maximum element in a Matrix
- Minimum element of each row and each column in a matrix
- Construct a matrix such that union of ith row and ith column contains every element from 1 to 2N-1
- Maximum sum of a Matrix where each value is from a unique row and column
- Sum of matrix element where each elements is integer division of row and column
- Sum of matrix in which each element is absolute difference of its row and column numbers
- Check whether row or column swaps produce maximum size binary sub-matrix with all 1s
- Find trace of matrix formed by adding Row-major and Column-major order of same matrix
- Program to find the Sum of each Row and each Column of a Matrix
- Find a Square Matrix such that sum of elements in every row and column is K
- Given a Boolean Matrix, find k such that all elements in k'th row are 0 and k'th column are 1.
- Find if a binary matrix exists with given row and column sums
- Find probability of selecting element from kth column after N iterations
- Maximum sum of any submatrix of a Matrix which is sorted row-wise and column-wise
- Maximum neighbor element in a matrix within distance K
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.