Given a matrix, the task is to find the maximum element of each row.
Input : [1, 2, 3] [1, 4, 9] [76, 34, 21] Output : 3 9 76 Input : [1, 2, 3, 21] [12, 1, 65, 9] [1, 56, 34, 2] Output : 21 65 56
Approach : Approach is very simple. The idea is to run the loop for no_of_rows. Check each element inside the row and find for the maximum element. Finally, print the element.
Below is the implementation :
8 11 76 5
- Program to find the maximum element in a Matrix
- Find maximum element of each column in a matrix
- Replace every matrix element with maximum of GCD of row or column
- Maximum weight path ending at any element of last row in a matrix
- Find the element in the matrix generated by given rules
- Find a sub matrix with maximum XOR
- Find row with maximum sum in a Matrix
- Find the original matrix when largest element in a row and a column are given
- Find column with maximum sum in a Matrix
- Find smallest and largest element from square matrix diagonals
- Find a common element in all rows of a given row-wise sorted matrix
- Find pair with maximum difference in any column of a Matrix
- Find alphabet in a Matrix which has maximum number of stars around it
- Find row with maximum and minimum number of zeroes in given Matrix
- Find Maximum side length of square in a Matrix
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.