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.
- 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
- Sum of matrix in which each element is absolute difference of its row and column numbers
- Sum of matrix element where each elements is integer division of row and column
- Check whether row or column swaps produce maximum size binary sub-matrix with all 1s
- Program to find the Sum of each Row and each Column of a Matrix
- Find trace of matrix formed by adding Row-major and Column-major order of same matrix
- 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
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.